Files
GrowlerFury/skunk_works/test_world.gd
T

41 lines
1.3 KiB
GDScript
Raw Normal View History

class_name TestWorld extends Node3D
func _process(delta: float) -> void:
var jet: Node3D = $jet
var jet2: Node3D = $jet2
var target_ray: RayCast3D = jet.get_node("target_ray")
#var direction: Vector3 = (
#jet2.global_position - jet.global_position
#).normalized()
var target_direction = jet.to_local(jet2.global_position).normalized()
#var target_direction = jet.to_local(jet2.global_position)
target_ray.target_position = target_direction * 2
# NOTE: (From GPT) Mostly works but with precession nor do I really understand it...
#var forward_dot: float = target_direction.dot(Vector3.UP)
#print(forward_dot)
#print(jet.rotation.angle_to())
#print("Up: " + str((target_direction).dot(Vector3.UP)) )
print("Forward: " + str((target_direction).dot(Vector3.FORWARD)) )
# NOTE: (From GPT) Mostly works but with precession nor do I really understand it...
#var forward_dot: float = target_direction.dot(Vector3.UP)
#if forward_dot >= cos(deg_to_rad(37.5)):
#get_node("../../base_ui/target_position_fb").text = "infront"
#jet.controller.cpu.no_action()
#else:
#get_node("../../base_ui/target_position_fb").text = "behind"
#if target_direction.x >= 0.2:
#jet.controller.cpu.yaw_right()
#elif target_direction.x <= -0.2:
#jet.controller.cpu.yaw_left()