Need help with 3D flying controls.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Klack

Hey guys,

For the life of me I cannot figured out 3D flight axis directions. I’m trying to get “W” and “S” to rotate around x axis(pitch) as in take off and land. “A” and “D” to roll as in a barrel roll to inverted flight. And forward down the local -z axis controlled by an increment in throttle(speed) to a set max speed and decrement down to 0. I’m able to get one set but not all sets together. For example, I can get WASD controls to work on local axis by using rotate_object_local(transform.basis.x/y/z…). I can make the object fly along local -z axis with input actions increasing/decreasing variable velocity. Velocity as an argument in move_and_slide(velocity, Vector3.UP(I’ve even tried transform.basis.y here)). So basically I can get pitch and roll to work together on local axis and I can get movement along local -z axis by itself. but as soon as I put roll, pitch, and movement together or even movement with just one; it just doesn’t work out one or two controls revert back to global axis. I’ve read multiple forums and watched videos and I can’t get anything to work. Sorry for not much code I wrote this on my phone.

Thanks