Get how fast an actor is moving forward

You want to call GetVelocity (A) and GetActorForwardVector (B). Then feed A and B into a DotProduct node. From that output, call VectorLength and that will be the speed in the forward direction relative to the character.

1 Like

I’m trying to get the how fast my character is moving forwards but am have difficulty. Does anyone know of a way to do this?

I am trying to understand the answer you provided here. I looked in the Kismet library to find these nodes since I use C++ and am not very good with blueprints, but reverse engineer via the Kismet when a calculation is what I need.

The DotProduct node would take a Vector (.Velocity()) and Vector (.GetActorForwardVector()) as parameters and returns a float, the VectorLength takes in a Vector and returns a float. How do you take the VectorLength (.Size()) of the result of the DotProduct? Could you elaborate on what you meant because I need this calculation, but I’m not understanding how you meant the sequence to work?

I interpreted what you said to work out to:
speedfloatvalue = DotProduct(ActorVelocity, ActorForwardVector).Size()
which doesn’t seem possible. Thanks for any clarification.

In your character class:

float ForwardVelocity = FVector::DotProduct(GetVelocity(), GetActorForwardVector());
float RightVelocity = FVector::DotProduct(GetVelocity(), GetActorRightVector());    

Yeah I made an oopsie. DotProduct gives you the length, a float. Not a Vector.

3 Likes

Thanks for the clarification. I’m sure it will help others too.