Velocity issues

Godot 4

I am trying to find a way to make this work on only the z axis and not affect the rest of the velocity
velocity = global_transform.basis.z * -SPEED

currently its affecting all velocity and I only want it to affect the Z axis, any questions can likely be answered

What’s the big picture, what problem are you running into that you think removing the z axis influence will help? I’m sure you don’t only want the world-x axis, unless you are making a 2.5d game?

sorry for the delay but heres kind of what i want


so I want velocity = look_direction * SPEED to only affect the Z axis or at least ignore the Y axis / velocity

Whatever your SPEED enumerator is, you’re multiplying it by a basis. Maybe instead try velocity.z to set just the z component of the velocity.

i will try that