summaryrefslogtreecommitdiff
path: root/backup_stuff/Sailor.gd
diff options
context:
space:
mode:
authorAnson Bridges <bridges.anson@gmail.com>2022-08-31 00:26:34 -0700
committerAnson Bridges <bridges.anson@gmail.com>2022-08-31 00:26:34 -0700
commitd3998186c9795f2a85148cd5bcfa1bd5b6226cfb (patch)
treeba5cae524562818ee38da48dd09b0b42a733e1d8 /backup_stuff/Sailor.gd
Initialize repo
Diffstat (limited to 'backup_stuff/Sailor.gd')
-rw-r--r--backup_stuff/Sailor.gd43
1 files changed, 43 insertions, 0 deletions
diff --git a/backup_stuff/Sailor.gd b/backup_stuff/Sailor.gd
new file mode 100644
index 0000000..24b93f9
--- /dev/null
+++ b/backup_stuff/Sailor.gd
@@ -0,0 +1,43 @@
+extends KinematicBody
+
+
+# Declare member variables here. Examples:
+# var a = 2
+# var b = "text"
+export(NodePath) var parent_vehicle = null
+#onready var nav_agent : NavigationAgent = get_node("NavigationAgent")
+var parent_vehicle_nav = null
+
+var destination = Vector3.ZERO
+var closest_point = Vector3.ZERO
+var direction = Vector3.ZERO
+var path = null
+var pathfinding = false
+
+const speed = 5
+var velocity = Vector3.ZERO
+
+
+# Called when the node enters the scene tree for the first time.
+func _ready():
+ if parent_vehicle != null:
+ parent_vehicle = get_node(parent_vehicle)
+ parent_vehicle_nav = parent_vehicle.get_node("Navigation")
+ #nav_agent.set_navigation(parent_vehicle_nav)
+
+func update_destination(new_dest):
+ pass#nav_agent.set_target_location(new_dest)
+
+func move(delta):
+ var target = Vector3.ZERO#nav_agent.get_next_location()
+ var direction : Vector3 = (target - global_transform.origin).normalized() * speed
+ velocity.y -= 9.8*delta
+ velocity.x = direction.normalized().x*speed
+ velocity.z = direction.normalized().z*speed
+ #nav_agent.set_velocity(Vector3(velocity.x,0,velocity.z))
+ velocity = move_and_slide(velocity, Vector3.UP, true, 4, 0.785, false)
+
+
+# Called every frame. 'delta' is the elapsed time since the previous frame.
+func _physics_process(delta):
+ move(delta)