About my "scene" I have a vehicule using simple joints, a character using same types of joints and attached to the vehicule with custom joints, both made of simple and coumpound primitives, I have a world made of a collision tree primitive, and some cube attached to nothing (except gravity).
After a compiled with 2.0 sdk the cube was the onnly thing seaming normal (falling on the floor) except it bounced more and more. The vehicule seamed broken with anarchic movement. Removing all applied forces and torques and incativating every custom joints changed nothing.
Have you changed the way the matrix works ? Is there something that must be initialised ? Please help me because I don't know where to search... here a few thing I do (wrong I hope):
- Code: Select all
///basic initialisation...
nWorld = NewtonCreate (PhysicsAlloc, PhysicsFree);
NewtonSetSolverModel(nWorld,0);
NewtonSetFrictionModel(nWorld,1);
defaultID = NewtonMaterialGetDefaultGroupID (nWorld);
NewtonMaterialSetDefaultSoftness (nWorld, defaultID, defaultID, 1.0f);
NewtonMaterialSetDefaultElasticity (nWorld, defaultID, defaultID, 0.05f);
NewtonMaterialSetDefaultCollidable (nWorld, defaultID, defaultID, 1);
NewtonMaterialSetDefaultFriction (nWorld, defaultID, defaultID, 1, 1);
NewtonMaterialSetCollisionCallback (nWorld, defaultID, defaultID, NULL, GenericContactBegin, GenericContactProcess);
//add some geometry
NewtonCollision* collision[2];
D3DXMATRIX location,mat0;
D3DXMatrixIdentity(&location);
//
D3DXMatrixTranslation(&mat0,0/kscale,2.42f/kscale,0/kscale);
collision[0] = NewtonCreateBox (nWorld, 2.23f/kscale,4.93f/kscale,0.4f/kscale,0, &mat0._11);
//
D3DXMatrixTranslation(&mat0,0/kscale,5.31f/kscale,0/kscale);
collision[1] = NewtonCreateBox (nWorld, 7.28f/kscale,0.87f/kscale,0.92f/kscale,0, &mat0._11);
NewtonCollision* collcompoud=NewtonCreateCompoundCollision(nWorld,2,collision,0);
body = NewtonCreateBody (nWorld, collcompoud);
NewtonReleaseCollision (nWorld, collision[0]);
NewtonReleaseCollision (nWorld, collision[1]);
NewtonReleaseCollision (nWorld, collcompoud);
// * * * * * *
NewtonBodySetUserData (body, &data);
NewtonBodySetTransformCallback (body, PhysicsSetTransform);
NewtonBodySetForceAndTorqueCallback (body, PhysicsApplyForceAndTorque);
V=D3DXVECTOR3(6.0f/kscale,4.93f/kscale,0.9f/kscale);
mass = 0.2f;
Ixx = 0.7f * mass * (V.y * V.y + V.z * V.z) / 12.0f;
Iyy = 0.7f * mass * (V.x * V.x + V.z * V.z) / 12.0f;
Izz = 0.7f * mass * (V.x * V.x + V.y * V.y) / 12.0f;
NewtonBodySetMassMatrix (body, mass, Ixx, Iyy, Izz);
NewtonBodySetMatrix (body, &location._11);
PhysicsSetTransform (body, &location._11,0);
//some joint
point=D3DXVECTOR3(0,0,0);
dir=D3DXVECTOR3(1,0,0);
JCB= NewtonConstraintCreateHinge(nWorld, &point.x, &dir.x,body0, body1);
NewtonHingeSetUserCallback(JCB,b01Callback);
NewtonJointSetUserData(JCB,this);
Hope I'll have an answer, thanks.