1. Physics for Euphoria
- Posted by Icy_Viking Sep 11, 2017
- 1374 views
Hello,
I have tried my hand at wrapping the ODE Physics engine. So far it runs without any errors. Any feedback would be great. ODE is written in C++, but uses a C like format, making it easy to wrap many of the functions.
http://www.rapideuphoria.com/uploads/euode.zip
This is a simple example I just made. I plan to add it into the pacakage once EuODE is hosted on RapidEuphoria.
without warning include std/machine.e include std/math.e include EuODE.ew atom world,body constant RADIUS = 0.2 constant MASS = 1.0 atom pos,r dInitODE() world = dWorldCreate() dWorldSetGravity(world,0,0,-0.001) body = dBodyCreate(world) atom m = allocate(10) atom mass = peek4s(m) atom g = allocate(10) atom gm = peek4s(g) dMassSetZero(mass) dMassSetSphereTotal(mass,MASS,RADIUS) dBodySetMass(body,mass) dBodySetPosition(body,10,10,10) dWorldQuickStep(world,gm) pos = dBodyGetPosition(body) r = dBodyGetRotation(body) dWorldDestroy(world) position(1,1) printf(1,"Pos: %d",{pos}) position(2,1) printf(1,"Rad: %d",{r}) integer key while 1 do key = get_key() if key = 27 then exit end if end while dCloseODE() free(m) free(g)