How do I find the forward speed of a CharacterBody3D?

Godot Version



so, I have this CharacterBody3D that I’m moving down in the global axis, and I want to see what the forward speed on the local axis is (since the function is for an aircraft stall feature, and I want to end the stall if the player is pointing down while they fall and moving “forward” locally).

What method or command would I use to check this, if there is one?

Thanks, Fishbed.

It depends on which way is “forward” on your CharacterBody3D, but

velocity.project(quaternion * Vector3.RIGHT)

this will get you the portion of your velocity parallel to that direction. Just replace Vector3.RIGHT with whatever your forward is. Taking the magnitude of that velocity will give you your forward speed.