Cleanup controller logic; tested more dot product stuff
This commit is contained in:
@@ -36,15 +36,16 @@ func process_jet_plan(jet: Jet) -> void:
|
||||
|
||||
var target_local_position: Vector3 = jet.to_local(jet.target.global_position)
|
||||
var target_direction: Vector3 = target_local_position.normalized()
|
||||
jet.target_ray.target_position = target_direction * 8
|
||||
jet.target_ray.target_position = target_direction
|
||||
|
||||
#NOTE: When using unit (normalized) vectors, the result will always be
|
||||
# between -1.0 (180 degree angle) when the vectors are facing opposite
|
||||
# directions, and 1.0 (0 degree angle) when the vectors are aligned.
|
||||
|
||||
var forward_dot: float = target_direction.dot(Vector3.UP)
|
||||
var ud_dot: float = target_direction.dot(Vector3.FORWARD)
|
||||
var lr_dot: float = target_direction.dot(Vector3.RIGHT)
|
||||
print(rad_to_deg(cosh(forward_dot)))
|
||||
|
||||
jet.controller.cpu.yaw_left()
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -18,19 +18,3 @@ func process(delta: float) -> Globals.CompoundCommand:
|
||||
return player.process(delta)
|
||||
_:
|
||||
return Globals.CompoundCommand.new()
|
||||
|
||||
func physics_process(delta: float) -> Globals.CompoundCommand:
|
||||
if Globals.ControlMode.CPU_MODE == control_mode:
|
||||
return cpu.physics_process(delta)
|
||||
elif Globals.ControlMode.PLAYER_MODE == control_mode:
|
||||
return player.physics_process(delta)
|
||||
|
||||
return Globals.CompoundCommand.new()
|
||||
|
||||
func unhandled_input(event: InputEvent) -> Globals.CompoundCommand:
|
||||
if Globals.ControlMode.CPU_MODE == control_mode:
|
||||
return cpu.unhandled_input(event)
|
||||
elif Globals.ControlMode.PLAYER_MODE == control_mode:
|
||||
return player.unhandled_input(event)
|
||||
|
||||
return Globals.CompoundCommand.new()
|
||||
|
||||
@@ -7,13 +7,6 @@ var commands: Globals.CompoundCommand = Globals.CompoundCommand.new()
|
||||
func process(_delta: float) -> Globals.CompoundCommand:
|
||||
return commands
|
||||
|
||||
func physics_process(_delta: float) -> Globals.CompoundCommand:
|
||||
return commands
|
||||
|
||||
func unhandled_input(_event: InputEvent) -> Globals.CompoundCommand:
|
||||
return commands
|
||||
|
||||
|
||||
func pitch_up() -> void:
|
||||
commands.PITCH = Globals.ControllerCommand.PITCH_UP
|
||||
|
||||
|
||||
@@ -29,12 +29,6 @@ func process(_delta: float) -> Globals.CompoundCommand:
|
||||
|
||||
return commands
|
||||
|
||||
func physics_process(_delta: float) -> Globals.CompoundCommand:
|
||||
return Globals.CompoundCommand.new()
|
||||
|
||||
func unhandled_input(_event: InputEvent) -> Globals.CompoundCommand:
|
||||
return Globals.CompoundCommand.new()
|
||||
|
||||
func no_action() -> void:
|
||||
commands.PITCH = Globals.ControllerCommand.NONE
|
||||
commands.YAW = Globals.ControllerCommand.NONE
|
||||
|
||||
Reference in New Issue
Block a user