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
Implementing Newton Physics
-
mauzi the Dude
- Posts: 4
- Joined: Fri Jun 17, 2005 9:07 am
- Location: 127.0.0.1 - Innsbruck, Austria
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
helper constants
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
...
}
Code: Select all
const float NewtonToIrrlicht = 32.0f;
const float IrrlichtToNewton = (1.0f / NewtonToIrrlicht);