Implementing Newton Physics

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Guest

Implementing Newton Physics

Post by Guest »

I`m trying to get Newtonworking in Irrlicht and I am having trouble understanding how objects in 3d space and object in newtons space are linked together.
Iknow you have to write a callback function but I dont understand how data from newton is applied to the object in Irrlicht. Please help
mauzi the Dude
Posts: 4
Joined: Fri Jun 17, 2005 9:07 am
Location: 127.0.0.1 - Innsbruck, Austria

Post by mauzi the Dude »

using newton and irrlicht together your class will have: ISceneNode, IMesh, NewtonCollision and a NewtonBody. To apply the physic calculations from newton to your irrlicht objects use the SetMeshTransformEvent callback someway like this

Code: Select all

SetMeshTransformEvent(const NewtonBody* body, const float* matrix) 
{
...
NewtonBodyGetMatrix(body, &matrix); // get matrix from  
calculate the  matrix for rendering (adopt unitscale, offset, camerapos, etc)
sceneNode->setPosition(matrix.getTranslantion()); //apply renderposition 
... 
}
helper constants

Code: Select all

const float NewtonToIrrlicht = 32.0f;
const float IrrlichtToNewton = (1.0f / NewtonToIrrlicht);
Post Reply