I have to somehow put the condition if z axis rotation is a certain angle, then a certain movement must happen.
How do I tell it to check the angle of the Z axis of the KinematicBody?
This is where I'll need to add specifications in the code:
if Input.is_action_pressed("forward") #&& z axis rotation is < 360 & > 270 <- How do I tell it this? :
direction += aim.x - aim.y
if Input.is_action_pressed("forward") #&& z axis rotation is > 0 & < 90 <-- How do I tell it this? :
direction += aim.x+ aim.y
if Input.is_action_pressed("forward") #&& z axis rotation is = 90 <-- How do I tell it this? :
direction += aim.y
if Input.is_action_pressed("forward") #&& z axis rotation is = 270 <-- How do I tell it this? :
direction += - aim.y
if Input.is_action_pressed("forward") #&& z axis rotation is = 0 <-- How do I tell it this? :
direction += aim.x
EDIT: I finally got something that seems to be working and no longer gives me errors.
Example:
if Input.is_action_pressed("forward") && $"Mesh Name".rotation_degrees.z > 0 && $"Mesh Name".rotation_degrees.z < 90
direction += aim.x+ aim.y
EDIT2: It works for looking up, but I'm not sure why the angles for looking down don't work. I tried < 360 and > 270 for the situation of the drone looking down and using W, but nothing's happening.
EDIT3: Ok, I figured out what Godot's doing here. Now it works for downward too.
