Hi, StrikerSVX again, i need some help to develop some basic aircraft controls, things like pitch, yaw and roll (i really don't know if this terms are correct), i already made simple script but im having problems making the plane behave like a plane would do.
extends KinematicBody
var turn_speed = 30
var speed = 10
var rot_x = 0.0
var rot_y = 0.0
var rot_z = 0.0
func _physics_process(delta):
get_input(delta)
rotation_degrees.x = rot_x
rotation_degrees.y = rot_y
rotation_degrees.z = rot_z
$CameraRig.rotation_degrees.z = -rot_z
move_and_collide(-transform.basis.z * speed * delta)
func get_input(delta):
if Input.is_action_pressed("W"):
rot_x += turn_speed * delta
if Input.is_action_pressed("S"):
rot_x += -turn_speed * delta
if Input.is_action_pressed("D"):
rot_y += -turn_speed * delta
if Input.is_action_pressed("A"):
rot_y += turn_speed * delta
if Input.is_action_pressed("Q"):
rot_z += turn_speed * delta
if Input.is_action_pressed("E"):
rot_z += -turn_speed * delta
the plane is a simple kinematicbody + meshinstance with collisions and a camera inside a spatial node called CameraRig, right now everything the plane do is pitch up and down, roll left and right, turn left and right, but when i roll the plane, the pitch doesn't change and turning left and right doesn't look or fell like a plane, it appears to be something like how to make the rolling change the direction the plane is going to go when you want it to go up or down, but i don't know, if you have something to point me in the right direction i would apreciate, searching for tutorials didn't help in anything because there's almost none in this topic.