Hi,
It's not the scale. The sizes of both engine's match perfectly in geometry.
http://yustme.g0dsoft.com/Projects/newtonStrangeBehavior.JPG
It just looks like the collision geometry is both with the graphics object and floating somewhere else too.
Moderators: Sascha Willems, walaber
Delfi wrote:I would bet good money that there has to be a issue with your conversion of data from newton matrix to your body mesh here:
mesh->setPosition(mat.getTranslation());
mesh->setRotation(mat.getRotationDegrees());
What does the setposition and setrotation do? can you not just copy the matrix to the object directly? that should just work..
If you are using the rotation and translation separatedly to rebuild the matrix, it is possible you are multiplying matrices in wrong order (i seen similar errors happen when rotation and translation matrixes were multiplied in wrong order)
Julio Jerez wrote:I thought somethong like what we see my be going on.
can you just make for one box so the you can determine the relation beter teh body matrix an dteh visual object.
I think you might be right, i've tried this like 3 months ago, copy the matrix directly. But it gives me a nullpointer exception at runtime, no matter what i tried.
// set the transformation of a rigid body.
// You have to do this so that the Newton body and irrLicht scene node are in sync,
// and you actually see the changes created by the physics simulation
void CNewton::PhysicsSetTransform(const NewtonBody* body, const float* matrix, int threadIndex)
{
matrix4 mat;
memcpy(mat.pointer(), matrix, sizeof(float) * 16);
NewtonWorld *world = NewtonBodyGetWorld(body);
CNewton* irrWorld = (CNewton*)NewtonWorldGetUserData(world);
IAnimatedMesh* mesh = (IAnimatedMesh*)NewtonBodyGetUserData(body);
IMeshManipulator* mm = irrWorld->newtonIrrPtr->getSceneManager()->getMeshManipulator();
if(mesh)
{
mm->transformMesh(mesh, mat);
}
}
// set the transformation of a rigid body.
// You have to do this so that the Newton body and irrLicht scene node are in sync,
// and you actually see the changes created by the physics simulation
void CNewton::PhysicsSetTransform(const NewtonBody* body, const float* matrix, int threadIndex)
{
/*
matrix4 mat;
memcpy(mat.pointer(), matrix, sizeof(float) * 16);
IMeshSceneNode* mesh = (IMeshSceneNode*)NewtonBodyGetUserData(body);
if(mesh)
{
mesh->setPosition(mat.getTranslation());
mesh->setRotation(mat.getRotationDegrees());
}
*/
IMeshSceneNode* mesh = (IMeshSceneNode*)NewtonBodyGetUserData(body);
if(mesh)
{
const matrix4& mat = *(matrix4*)matrix;
core::vector3df rotation;
NewtonGetEulerAngle(mat.pointer(), &rotation.X);
rotation = rotation * (180.0f/3.1416f);
mesh->setPosition(mat.getTranslation());
mesh->setRotation(rotation);
}
}
Users browsing this forum: No registered users and 25 guests