adde compound command calling for multi input control; added notes on dot product; testing stuff in skunk works folder
This commit is contained in:
+31
-13
@@ -1,22 +1,40 @@
|
||||
@tool
|
||||
class_name TestWorld extends Node3D
|
||||
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
var jet: Jet = $jet
|
||||
var jet2: Jet = $jet2
|
||||
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()
|
||||
target_ray.target_position = direction
|
||||
#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)
|
||||
|
||||
#var target_basis = Basis.looking_at(direction, Vector3.UP)
|
||||
#var target_rotation = target_basis.get_euler()
|
||||
#var current_rotation = jet.global_rotation
|
||||
target_ray.target_position = target_direction * 2
|
||||
|
||||
#print(jet.global_rotation)
|
||||
#print(target_rotation)
|
||||
#jet.global_rotation = target_rotation
|
||||
# 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()
|
||||
|
||||
Reference in New Issue
Block a user