https://giphy.com/gifs/V2CddHlTwquudl8GwV
I got it mostly working but as you can see since the parent is responsible for X axis rotation and since its not moving with the ship, the ship will only rotate around the parent and not itself. And I need it to rotate around itself.
Tree:
Parent(X axis rotation)
->Child(Y axis rotation + forward and back movement)
->->Ship OBJ
I believe the potential fix for this is to either make the parent copy the child's position (but I cant get it to work for some reason) or make one on them do both rotations.
Attached To Parent
func _input(event):
if event is InputEventMouseMotion and Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED:
child.rotate_x(deg2rad(event.relative.y * MOUSE_SENSITIVITY *-1))
self.rotate_y(deg2rad(event.relative.x * MOUSE_SENSITIVITY * -1))
Attached To Child
var speed = 0
func _physics_process(delta):
if Input.is_key_pressed(KEY_E):
speed = speed + .1
if Input.is_key_pressed(KEY_Q):
speed = speed - .1
translate(Vector3(0,0,delta*speed))
If you have another way of doing this movement I would very much appreciate if you could help me!