Getting just horizontal velocity in 3D

Godot Version

godot 4.3

Question

hello, for my attempt to recreate the CSGO gamemode HNS in godot i would like to be having a speed counter.
the velocity.length function is doesn’t work for this purpose as i only want to have horizontal speed shown.
the solution i tried was $"../..".player.velocity.length() - abs($"../..".player.velocity.y) but that doesnt work. any feedback yall could have to help me solve this issue.

Hi.

It seems, you need to calculate the speed of the velocity vector along the horizontal plane (x, z axes).

var horizontal_velocity = Vector2(velocity.x, velocity.z).length()

Hope this will helps.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.