Get Component Velocity vs Get Physics Linear Velocity

This has been a little bit confusing so I thought I'd share. When working with motioncontrollers I often want to know how fast the player is moving his hands/weapons. There are two ways one might think to do this:

 This will constantly return 0, and I thought it was weird. Apparently, Get Component Velocity returns Velocity relative to the parent, and since Rheld Actor Static Mesh is attached to the motioncontroller component (it's parent), this will always return 0.

The right way to do it is using this function instead:


"Linear velocity is the velocity of the object traveling in a straight line or in other words the body is said to be moving with linear velocity when its direction is not changing."

I'm confused about this because the player is almost always changing the direction of where he moves the motioncontroller, so it seems like I would want "Physics Velocity", and not linear. This function does however not exist. Using Linear Velocity works just fine for what I'm trying to do, but I'm unsure whether it's 100% correct

If you want to know how fast the player is moving his hands/weapons, just get the vector length:

"Vector length squared" will not return the exact length, but it's about 4x cheaper to use than vector length, and we only want to compare the value against a threshold, not know how far he moved the controller (in this case).

Let me know if you have any questions!


Comments

Popular posts from this blog

Achieve straight node lines within your blueprints!

Capture your scene as a cubemap in Unreal!