diff options
Diffstat (limited to 'Spear/Physics/Rigid.hs')
| -rw-r--r-- | Spear/Physics/Rigid.hs | 12 |
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 | ) |
| 8 | where | 10 | where |
| 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. | ||
| 85 | setVelocity :: Velocity -> RigidBody -> RigidBody | ||
| 86 | setVelocity v body = body { velocity = v } | ||
| 87 | |||
| 88 | |||
| 89 | -- | Set the body's acceleration. | ||
| 90 | setAcceleration :: Acceleration -> RigidBody -> RigidBody | ||
| 91 | setAcceleration a body = body { acceleration = a } | ||
| 92 | |||
| 93 | |||
| 82 | -- test | 94 | -- test |
| 83 | gravity = vec3 0 (-10) 0 | 95 | gravity = vec3 0 (-10) 0 |
| 84 | b0 = rigidBody 50 $ vec3 0 1000 0 | 96 | b0 = rigidBody 50 $ vec3 0 1000 0 |
