Add velocity in a specific direction

version 4

how can I apply velocity in the direction of a object, for example a marker 3d.
Im using as characterbody3d

image

I tried this already

You could use the child’s global_basis.z to apply it’s forward direction

velocity = slip_direction.global_basis.z * slippy_speed
1 Like

i am getting an error that says Invalid get index global_basis (on base: Marker3d)
realized now that basis.z works

also I tried doing this
image
but it didnt work, also the object i want to add velocity toward moves, essentially i have a marker 3d in front of the player and I want to add velocity toward that marker 3d

you probably could have assumed that though

Try slip_direction.global_transform.basis.z. A local basis or transform may not have any rotation at all.

If global_basis does not exist you may be on a version older than 4.3

1 Like

i should probably update versions after this project (THANKS A LOT BRO)