aboutsummaryrefslogtreecommitdiff
path: root/Spear/Physics/Rigid.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Spear/Physics/Rigid.hs')
-rw-r--r--Spear/Physics/Rigid.hs12
1 files changed, 12 insertions, 0 deletions
diff --git a/Spear/Physics/Rigid.hs b/Spear/Physics/Rigid.hs
index b9c84d2..c3b4cfa 100644
--- a/Spear/Physics/Rigid.hs
+++ b/Spear/Physics/Rigid.hs
@@ -4,6 +4,8 @@ module Spear.Physics.Rigid
4, RigidBody(..) 4, RigidBody(..)
5, rigidBody 5, rigidBody
6, update 6, update
7, setVelocity
8, setAcceleration
7) 9)
8where 10where
9 11
@@ -79,6 +81,16 @@ update forces dt body =
79 RigidBody m r2 v2 a2 81 RigidBody m r2 v2 a2
80 82
81 83
84-- | Set the body's velocity.
85setVelocity :: Velocity -> RigidBody -> RigidBody
86setVelocity v body = body { velocity = v }
87
88
89-- | Set the body's acceleration.
90setAcceleration :: Acceleration -> RigidBody -> RigidBody
91setAcceleration a body = body { acceleration = a }
92
93
82-- test 94-- test
83gravity = vec3 0 (-10) 0 95gravity = vec3 0 (-10) 0
84b0 = rigidBody 50 $ vec3 0 1000 0 96b0 = rigidBody 50 $ vec3 0 1000 0