How to get "speed" from a mesh?

The blueprint is just an actor with a skeleton mesh. I want to get a velocity from that mesh I can feed to the ABP and turn this sliding piece of jello into a walking character.

Any help is appreciated thanks!

Hey @usa423!

If are wanting to get the velocity for just the skeletal mesh, you can use get component velocity. Otherwise, you can just use Get Velocity to get the velocity of the entire actor.

UnrealEditor_5ti28gbPd7

UnrealEditor_DY3IvTBYkA

Let me know if this works for you!

1 Like

Hey @Quetzalcodename thanks for trying to help me. Sadly I can’t get it to work. The skeletal mesh is set as the root of the actor. Is there any settings that need to be on? It is always reading 0 0 0 for x y and z even when the mesh is moving. Any ideas are appreciated.

Velocity → Length = Speed cm/s (float)

Set the print string KEY to 1

1 Like

Like this? Still ain’t getting anything. But thx Rev.

What’s applying movement to the P00Actor, thus the mesh?

1 Like

Meshes don’t have velocity. (Well, they kinda do when they render motion blur, but that’s a different thing than what you want here.)

Actors may have velocity. But if the actor is just teleported each frame, they won’t have velocity, they’ll just move around the screen/world.

You need a physics Body, or a MovementComponent, to properly apply and measure velocity of an Actor. The physics Body is great if movement is largely reactive (punched, exploded, buoyed, impacted, and so on) whereas a MovementComponent is needed if you want “custom” movement – trying to stick to floors, or moving based on user inputs, or involving suspension and engine simulation, for example. Also, to make the movement synchronize well with gameplay and over a network.

There are several different kinds (classes) of MovementComponent available; if your actor wants to move like a character, you should probably derive the actor from Character which comes with a CharacterMovementComponent.

Whenever you use a movement component, you can just call get-velocity on the actor, and it’ll return the correct value (in centimeters-per-second units.)

2 Likes

An Axis event input key press (Move Right) to a A set actor location fed by f interp , an added Y + or subtracted Y - as target, interp speed 2.0 and delta seconds. (For moving left and right)

This won’t have a velocity per say. You are manually moving it.

You’ll have to calculate velocity/speed yourself. Store Last location and game time (pre-move), get location end of move (current location).

Distance moved = Last Location (vector) - Current Location (Vector) → Length.
Move time = Move end time - Move start time.
Speed = Distance Moved / Move Time