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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Determine where a Character stops

In order to replicate Paragon's locomotion system I'm required to know where my character will end its movement, I've watched all the documentation about this subject (Twitch streams, Laurent Delayent presentation and the Unreal Engine API) but I can't figure out a way to calculate exactly where the actor stops moving.

My attempt was, knowing that only friction slows down the movement, the following:

 float Friction = Character->GetCharacterMovement()->GroundFriction * Character->GetCharacterMovement()->BrakingFrictionFactor;
 float WalkingDecelerationSpeed = Character->GetCharacterMovement()->BrakingDecelerationWalking;
 FVector StartingLocation = Character->GetActorLocation();
 FVector Velocity = Character->GetVelocity();
 const FVector RevAccel = -WalkingDecelerationSpeed * Velocity.GetSafeNormal();

 FVector StopLocation = StartingLocation + (-(Velocity*Velocity) / (2 * ((-Friction) * Velocity + RevAccel)));

 if ((2 * (-Friction) * Velocity.Z + RevAccel.Z) == 0)
     StopLocation.Z = StartingLocation.Z;

 if ((2 * (-Friction) * Velocity.Y + RevAccel.Y) == 0)
     StopLocation.Y = StartingLocation.Y;

 if ((2 * (-Friction) * Velocity.X + RevAccel.X) == 0)
     StopLocation.X = StartingLocation.X;

 return StopLocation;

Not only it has a low precision with default values of the CharaterMovementComponent, but it brakes comepletely if I try to change the value of BrakingDecelerationWalking, probably because I haven't understood correctly what BrakingDecelerationWalking and GroundFriction purpose are.

So, if anyone knows more about Kinematics in Unreal than I do, I'll be glad to know more about this two variables usage and how to predict the character stop location

Product Version: UE 4.19
more ▼

asked May 08 '18 at 06:21 AM in C++ Programming

avatar image

1 1

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Interesting problem. First, I'm pretty sure all the locomotion stuff from Paragon is going to be included in the next engine version. I think they said that in the stream. We're supposed to do what we can for now but if you want to try it yourself in the meantime, I can respect that.

You're probably going to have a hard time getting the prediction to be accurate all the time. You're calculating it once over the entire deceleration but the engine is handling it in frame-sized time periods. It might be worth trying to update the prediction each tick and then adjust the animation speed accordingly. If the predictions aren't too far off then the changes in animation speed won't be noticeable.

As far as the math itself. I obviously don't have experience with this so if you think the problem is in there then you should post a link to the formula you're using.

more ▼

answered May 08 '18 at 01:26 PM

avatar image

4.4k 32 77 42

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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