summaryrefslogtreecommitdiffstats
path: root/World.gd
diff options
context:
space:
mode:
Diffstat (limited to 'World.gd')
-rw-r--r--World.gd16
1 files changed, 16 insertions, 0 deletions
diff --git a/World.gd b/World.gd
new file mode 100644
index 0000000..09b8e85
--- /dev/null
+++ b/World.gd
@@ -0,0 +1,16 @@
+extends RigidBody
+
+export var acceleration = 10.0;
+
+func travel(direction:Vector3):
+ var boat_direction = $"/root/Main/Raft".global_transform.basis
+ boat_direction = Basis(Vector3.UP*boat_direction.get_euler().y)
+ direction = -direction
+ direction = boat_direction * direction
+ direction = direction.normalized()
+ self.add_central_force(direction*acceleration)
+
+func _integrate_forces(_state):
+ var stick = Input.get_axis("ship_down","ship_up")
+ if stick != 0.0:
+ travel(Vector3.FORWARD*stick)