Cleaned up notes; restructured test scene plus cpu controller script; added WIP action stack logic
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
class_name ActionBase extends Node
|
||||
|
||||
|
||||
func do(_jet: Jet) -> void:
|
||||
assert(false, "Must override 'do' method from child")
|
||||
func process(_jet: Jet) -> void:
|
||||
assert(false, "Must override 'process' method from child")
|
||||
|
||||
@@ -1,18 +1,21 @@
|
||||
class_name MoveTowards extends ActionBase
|
||||
|
||||
|
||||
func do(jet: Jet) -> void:
|
||||
func process(jet: Jet) -> void:
|
||||
if not is_instance_valid(jet.target): return
|
||||
|
||||
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
|
||||
jet.target_direction = 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.
|
||||
# Note also that, probably want to align order around node 'rotation_order' which is YXZ
|
||||
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)
|
||||
var ud_dot: float = target_direction.dot(Vector3.FORWARD)
|
||||
|
||||
|
||||
jet.controller.cpu.yaw_left()
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
class_name RollLeft extends ActionBase
|
||||
|
||||
|
||||
func process(jet: Jet) -> void:
|
||||
if not is_instance_valid(jet): return
|
||||
|
||||
jet.controller.cpu.roll_left()
|
||||
@@ -0,0 +1 @@
|
||||
uid://daep5cdrl6pwv
|
||||
@@ -0,0 +1,12 @@
|
||||
class_name RollLeftSideUp extends ActionBase
|
||||
|
||||
|
||||
func process(jet: Jet) -> void:
|
||||
if not is_instance_valid(jet): return
|
||||
check_orientation(jet)
|
||||
jet.controller.cpu.roll_left()
|
||||
|
||||
|
||||
func check_orientation(jet: Jet) -> void:
|
||||
#var rotation_dot = clampf(jet.rotation_degrees.z / 360.0, -1, 1)
|
||||
var rotation_norm = jet.rotation_degrees.normalized()
|
||||
@@ -0,0 +1 @@
|
||||
uid://tqa0386hofab
|
||||
@@ -0,0 +1,7 @@
|
||||
class_name RollRight extends ActionBase
|
||||
|
||||
|
||||
func process(jet: Jet) -> void:
|
||||
if not is_instance_valid(jet): return
|
||||
|
||||
jet.controller.cpu.roll_right()
|
||||
@@ -0,0 +1 @@
|
||||
uid://jgirej8jaxa3
|
||||
@@ -0,0 +1,12 @@
|
||||
class_name RollRightSideUp extends ActionBase
|
||||
|
||||
|
||||
func process(jet: Jet) -> void:
|
||||
if not is_instance_valid(jet): return
|
||||
check_orientation(jet)
|
||||
jet.controller.cpu.roll_right()
|
||||
|
||||
|
||||
func check_orientation(jet: Jet) -> void:
|
||||
#var rotation_dot = clampf(jet.rotation_degrees.z / 360.0, -1, 1)
|
||||
var rotation_norm = jet.rotation_degrees.normalized()
|
||||
@@ -0,0 +1 @@
|
||||
uid://gp6yl6ti2xvu
|
||||
Reference in New Issue
Block a user