|Attention||Topic was automatically imported from the old Question2Answer platform.|
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.
If you want your plane to have aerodynamics behavior when changing the attitude (pitch, yaw and roll) you need to implement it yourself. If you can’t find a tutorial on the topic maybe try to find a tutorial on flying simulation in any other programming language and port it to Godot. That is what I would do. There are probably dozens of articles on the subject with varying level of simulation accuracy.
Also I believe you are not using the right body to to physics, perhaps a rigidbody would be better and apply the lift, drag, thrust and gravity forces according to the attitude you are in.
Ram | 2020-03-05 01:52
That’s a way of doing it, but im trying to reach something a lot more basic and more arcady, there’s already a lot of aircraft simulations. But thanks for your comment, anything to help me create something functional is apreciated.
StrikerSVX | 2020-03-05 02:57