adde compound command calling for multi input control; added notes on dot product; testing stuff in skunk works folder
This commit is contained in:
@@ -38,46 +38,60 @@ func process_jet_plan(jet: Jet) -> void:
|
||||
var target_direction: Vector3 = target_local_position.normalized()
|
||||
jet.target_ray.target_position = target_direction * 8
|
||||
|
||||
if maxf(target_direction.z, 0.0) == 0.0:
|
||||
get_node("../../base_ui/target_position_fb").text = "infront"
|
||||
jet.controller.cpu.no_action()
|
||||
#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.
|
||||
|
||||
if target_direction.x > 0.2:
|
||||
jet.controller.cpu.yaw_right()
|
||||
elif target_direction.x < -0.2:
|
||||
jet.controller.cpu.yaw_left()
|
||||
|
||||
elif maxf(target_direction.y, 0.5) == 0.5:
|
||||
jet.controller.cpu.no_action()
|
||||
|
||||
if target_direction.y > 0.2:
|
||||
get_node("../../base_ui/target_position_ab").text = "above"
|
||||
jet.controller.cpu.pitch_up()
|
||||
elif target_direction.y < -0.2:
|
||||
get_node("../../base_ui/target_position_ab").text = "below"
|
||||
jet.controller.cpu.pitch_down()
|
||||
|
||||
elif maxf(target_direction.y, -0.5) == -0.5:
|
||||
get_node("../../base_ui/target_position_ab").text = "below"
|
||||
jet.controller.cpu.no_action()
|
||||
|
||||
if target_direction.y > 0.2:
|
||||
jet.controller.cpu.yaw_right()
|
||||
elif target_direction.y < -0.2:
|
||||
jet.controller.cpu.yaw_left()
|
||||
|
||||
else:
|
||||
get_node("../../base_ui/target_position_fb").text = "behind"
|
||||
jet.controller.cpu.no_action()
|
||||
|
||||
if target_direction.x > 0.2:
|
||||
jet.controller.cpu.yaw_right()
|
||||
elif target_direction.x < -0.2:
|
||||
jet.controller.cpu.yaw_left()
|
||||
var forward_dot: float = target_direction.dot(Vector3.UP)
|
||||
var lr_dot: float = target_direction.dot(Vector3.RIGHT)
|
||||
print(rad_to_deg(cosh(forward_dot)))
|
||||
|
||||
|
||||
get_node("../../base_ui/target_z").text = str(target_direction.z)
|
||||
get_node("../../base_ui/target_x").text = str(target_direction.x)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#if maxf(target_direction.z, 0.0) == 0.0:
|
||||
#get_node("../../base_ui/target_position_fb").text = "infront"
|
||||
#jet.controller.cpu.no_action()
|
||||
#
|
||||
#if target_direction.x > 0.2:
|
||||
#jet.controller.cpu.yaw_right()
|
||||
#elif target_direction.x < -0.2:
|
||||
#jet.controller.cpu.yaw_left()
|
||||
#
|
||||
#elif maxf(target_direction.y, 0.5) == 0.5:
|
||||
#jet.controller.cpu.no_action()
|
||||
#
|
||||
#if target_direction.y > 0.2:
|
||||
#get_node("../../base_ui/target_position_ab").text = "above"
|
||||
#jet.controller.cpu.pitch_up()
|
||||
#elif target_direction.y < -0.2:
|
||||
#get_node("../../base_ui/target_position_ab").text = "below"
|
||||
#jet.controller.cpu.pitch_down()
|
||||
#
|
||||
#elif maxf(target_direction.y, -0.5) == -0.5:
|
||||
#get_node("../../base_ui/target_position_ab").text = "below"
|
||||
#jet.controller.cpu.no_action()
|
||||
#
|
||||
#if target_direction.y > 0.2:
|
||||
#jet.controller.cpu.yaw_right()
|
||||
#elif target_direction.y < -0.2:
|
||||
#jet.controller.cpu.yaw_left()
|
||||
#
|
||||
#else:
|
||||
#get_node("../../base_ui/target_position_fb").text = "behind"
|
||||
#jet.controller.cpu.no_action()
|
||||
#
|
||||
#if target_direction.x > 0.2:
|
||||
#jet.controller.cpu.yaw_right()
|
||||
#elif target_direction.x < -0.2:
|
||||
#jet.controller.cpu.yaw_left()
|
||||
#
|
||||
#
|
||||
#get_node("../../base_ui/target_z").text = str(target_direction.z)
|
||||
#get_node("../../base_ui/target_x").text = str(target_direction.x)
|
||||
|
||||
|
||||
#var direction: Vector3 = (
|
||||
|
||||
Reference in New Issue
Block a user