https://github.com/vitalibarozzi/opende
Bindings of the physics engine Open Dynamics Engine for Haskell.
https://github.com/vitalibarozzi/opende
ode physics physics-engine physics-simulation
Last synced: 10 months ago
JSON representation
Bindings of the physics engine Open Dynamics Engine for Haskell.
- Host: GitHub
- URL: https://github.com/vitalibarozzi/opende
- Owner: vitalibarozzi
- Created: 2024-05-25T04:57:59.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-10-29T19:29:47.000Z (over 1 year ago)
- Last Synced: 2025-08-12T16:59:23.759Z (11 months ago)
- Topics: ode, physics, physics-engine, physics-simulation
- Language: Haskell
- Homepage:
- Size: 129 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.txt
Awesome Lists containing this project
README
OpenDE
------
A physics engine package for Haskell. Forked from
https://hackage.haskell.org/package/HODE, then started cleaning
it and adding StateVar API to match both OpenGL and OpenAL,
adding MonadIO instances, and whatever else was missing.
About ODE
---------
"ODE is an open source, high performance library for simulating
rigid body dynamics. It has advanced joint types and integrated
collision detection with friction. ODE is useful for simulating
vehicles, objects in virtual reality environments and virtual
creatures. It is currently used in many computer games, 3D
authoring tools and simulation tools. See http://www.ode.org/"
Completion
----------
[100%] Objects
[ 95%] Space
[ 70%] Body
[ 70%] Collision
[ 70%] Rotation
[ 70%] World
[ 50%] Mass
[ 10%] Tests
[ 1%] Error
[ -- ] Geom
[ -- ] Joint
Example usage
-------------
```
import qualified Physics.ODE.World as World
import qualified Physics.ODE as ODE
import qualified Physics.ODE.Geom as ODE
import qualified Physics.ODE.Body as Body
import Data.StateVar (($=!), get)
import Linear (V3)
import Control.Monad
import Control.Concurrent
main :: IO ()
main = do
let delay {- in milliseconds -} = 100000 :: Int
let dt {- in seconds -} = realToFrac delay / 10000000 :: Double
let g {- in m/s^2 -} = -9.81 :: Double
let h {- in meters -} = 20.0 :: Double
putStrLn "Starting ODE example usage."
() <- ODE.initODE
wd <- World.create
sp <- Space.create wd
bg <- Object.createSphere (Just sp) 1
mb <- Geometry.getBody bg
case mb of
Nothing -> error "No body found."
Just bb -> do
() <- World.gravity wd $=! V3 0 g 0
() <- Body.position bb $=! V3 0 h 0
Control.Monad.forM_ [1..10] $ \n -> do
________ <- Control.Concurrent.threadDelay delay
________ <- ODE.step dt wd
V3 _ y _ <- get (Body.position bb)
Prelude.putStrLn ("Ball position: "<>Prelude.show y<>"m")
() <- ODE.closeODE
putStrLn "ODE example is done."
```