Failure in dgBody::SetMassMatrix()

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

Failure in dgBody::SetMassMatrix()

Postby Bird » Wed Oct 08, 2014 6:15 am

Hi Julio,

I'm creating a compound body using NewtonCreateKinematicBody() and I keep hitting the assert in dgBody.cpp => dgBody::SetMassMatrix() on line 533. I don't see anything obviously wrong in my code. Can you tell me what I might be doing wrong to trigger that assert?

-Bird
Bird
 
Posts: 623
Joined: Tue Nov 22, 2011 1:27 am

Re: Failure in dgBody::SetMassMatrix()

Postby Julio Jerez » Wed Oct 08, 2014 8:52 am

can you show me the code so that I can test in the sand box?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Failure in dgBody::SetMassMatrix()

Postby Bird » Thu Oct 09, 2014 2:53 pm

Can you tell me if it's legal to build a CompoundColliison using the same Collision shape but with a different matrix each time?

Something like this

Code: Select all
NewtonCollision * compound = NewtonCreateCompoundCollision();
NewtonCompoundCollisionBeginAddRemove(compound);

NewtonCollision * collision = NewtonCreateConvexHull();

for( int i = 0; i < 10; i++ )
{
    NewtonCollisionSetMatrix(collision, new_matrix_goes_here);
     NewtonCompoundCollisionAddSubCollision(compound, collision);
}
NewtonCompoundCollisionEndAddRemove(compound);
Bird
 
Posts: 623
Joined: Tue Nov 22, 2011 1:27 am

Re: Failure in dgBody::SetMassMatrix()

Postby Julio Jerez » Thu Oct 09, 2014 3:23 pm

Bird wrote: Perfectly legal and very good,
do not forget to destroy the shape when you termite the loop
Code: Select all
NewtonCollision * compound = NewtonCreateCompoundCollision();
NewtonCompoundCollisionBeginAddRemove(compound);

NewtonCollision * collision = NewtonCreateConvexHull();

for( int i = 0; i < 10; i++ )
{
    NewtonCollisionSetMatrix(collision, new_matrix_goes_here);
     NewtonCompoundCollisionAddSubCollision(compound, collision);
}
NewtonCompoundCollisionEndAddRemove(compound);
NewtonDestroyCollison (collision);
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Failure in dgBody::SetMassMatrix()

Postby Bird » Thu Oct 09, 2014 5:01 pm

Code: Select all
do not forget to destroy the shape when you termite the loop

I don't destroy it there because in my real code, I'm re-using a NewtonCollision from a body that's already in the engine. That shouldn't be a problem, correct?

-Bird
Bird
 
Posts: 623
Joined: Tue Nov 22, 2011 1:27 am

Re: Failure in dgBody::SetMassMatrix()

Postby Julio Jerez » Thu Oct 09, 2014 7:14 pm

I saw they you created on the function
NewtonCollision * collision = NewtonCreateConvexHull();

if you are keeping track they it is ok.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles


Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 6 guests

cron