x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Stop movement speed of characters when hit the wall and animations when hit the wall?

I'm new to Unreal Engine 4, and I started to learn about 4 days ago, and now i'm trying to make running system with parkour elements but I'm stucked when character hit the wall but max walk speed( I think) still keep it value but not decrease to 0 because hit the wall XD.

I created a blueprint when player run depended on tps template, then stamina will decrease and camera will start shaking, but the problem when character hit the wall, the stamina still decrease and camera still shaking.

So I think the problem because the character movement speed still in max value. Can u guys help me stop the character movement speed when touch the wall? and add some animation when character hit a wall?


http://imgur.com/abeGRs7

http://imgur.com/mg0tUs8

Product Version: UE 4.14
Tags:
more ▼

asked Feb 11 '17 at 12:15 PM in Using UE4

avatar image

kuro0shin
6 2 3 4

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

it's because your logic says if the player pressed the button to run, so he is running(is run on = true) so i will reduce the stamina, but actually if the player press the key to run he is TRYING TO run, i suggest you to remove stamina based in the player velocity instead of removing 1 at every 0.2 seconds from stamina try to remove the speed / max walk speed (so if he is trying to run against a wall the speed will be 0 and the stamina won't be removed), you can type "get velocity" it will return the actors velocity and it's a vector, to get the actual speed grab the returned vector from velocity and type "get length".

have in mind: speed = length of the velocity vector. this is just a workaround, but you can achieve a better solution keeping in mind that you should also take the actual speed in count not just the max speed.

and maybe you know it, but you don't need to change the max speed every frame to have the "accelerating" feeling, you can also set "max acceleration" to a lower value, "max acceleration" is under character's movement general settings.

more ▼

answered Feb 11 '17 at 11:32 PM

avatar image

veccher
1.1k 31 16 65

avatar image kuro0shin Feb 12 '17 at 08:47 AM

I'll try that out. Tks for the answer :D

avatar image kuro0shin Feb 12 '17 at 09:47 AM

I tried velocity and length you said, it's can fix a few bug in my blueprint, but when the character run into the wall, its still keep counting down. So I think the problem here is because the movement input or in ThirdPerson_BP. xD

avatar image DeepFriedOreo Aug 05 '18 at 05:30 AM

This is clearly quite old but I found this looking for a solution and ended up coming up with one I figured I'd share for anyone else looking into this. The problem seems to be that getting the velocity really returns the "expected velocity". I came looking for a "complex" solution if you will, but the easiest and unfortunately only way I came up with to solve this would be to scan in front of the character for a wall manually. Simply add a box collision slightly protruding the front of the character, on begin overlap lock sprint, on end overlap unlock sprint. I however used a capsule trace. I did this so I could call it from a macro setup to return true or false similar to a branch just for cleanliness as I don't enjoy having a bunch of overlap events on my graph.

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question