Ok I found the bug. this is a legacy form newton 1.00
In newton 1.00 the representative of body in teh broadphase was eth body itselft,
for core 200 teh representative is a proxy object that link the node in teh bradphase and the body, plsus soem other braphase data.
in core 300 wit intrduce the Collision instance and it is part of teh pal to go back to teh method of core 100 where the body represent itself in teh braphase, but this time
it will be the instance of the body. I have no doen it yet and that is what case the problem.
I adde a work aroudn with is to update teh bady matrix.
here is the solution
- Code: Select all
NewtonBody* createTestCompound (DemoEntityManager* const scene, dFloat mass, const dMatrix& matrix, dVector size, int materialId)
{
NewtonWorld* const world = scene->GetNewton();
NewtonCollision* collision = NewtonCreateCompoundCollision(world, 0);
//create the rigid body
NewtonBody* const rigidBody = NewtonCreateBody (world, collision, &matrix[0][0]);
NewtonDestroyCollision(collision);
collision = NewtonBodyGetCollision(rigidBody);
NewtonCompoundCollisionBeginAddRemove(collision);//BEGIN
NewtonCollision* sub_col = NewtonCreateBox(world, size.m_x,size.m_y,size.m_z,0,0);
NewtonCompoundCollisionAddSubCollision(collision, sub_col);
NewtonDestroyCollision(sub_col);
NewtonCompoundCollisionEndAddRemove(collision); //END
// add this line because after you change the collision of a body,
// if the bod is static, the broad phase does not knows that a child shape shape, so it has no reason to update the
// node location in the database. this will not be need it when the collision instance is the representative of the
// body in the broaphase, but for now this si a work around
NewtonBodySetMatrix(rigidBody, &matrix[0][0]);
DemoMesh* const geometry = new DemoMesh("cylinder_1", collision, "smilli.tga", "smilli.tga", "smilli.tga");
after I have the Model editor further alone I will complete that part of teh collsion instance whch will unific teh treatme of stuff like, Triggers, and Kineatic bodies in teh aabb.
Bascially a collsion intanace will be what teh body place in the AABB, becasieo fo this a collsion instance by itsefl can be added to teh braphase and tah make newton a 100 % full collsion systm
no need for extra statioc collsion update, or contrive flags to indicate that a shape is a trigger, of that a body is a kenematic body.
for now just add that lien of code each time you modify the body shape, and it should work
I added that demo to teh list of SDK demos. you can sinck and check it out.