A place to discuss everything related to Newton Dynamics.
Moderators: Sascha Willems, walaber
by izissise » Sat Aug 28, 2010 8:03 am
Hello,
When my bodies hit another they bounce and move strangely see at yourself :
http://www.upndl.com/f/b4b0cb6525f9923fee056ceddffc8310 (just press two time "Télécharger le fichier" ....)
So I don't know what causing this problem because body have default material ....
-
izissise
-
- Posts: 23
- Joined: Sat Jul 24, 2010 8:20 am
by ledahut » Mon Aug 30, 2010 2:47 am
Look like you did not set correctly inertial mass matrix with NewtonBodySetMassMatrix.
Here some formula
http://www.sciences-indus-cpge.apinc.or ... es-solides for primitive.
Or simply use the function NewtonConvexCollisionCalculateInertialMatrix
-
ledahut
-
- Posts: 98
- Joined: Mon Jun 21, 2010 8:03 am
- Location: France
by izissise » Mon Aug 30, 2010 7:59 am
Ok thank you I will see that !

-
izissise
-
- Posts: 23
- Joined: Sat Jul 24, 2010 8:20 am
by izissise » Mon Sep 06, 2010 1:31 pm
So, that don't work
I implanted it like that :
- Code: Select all
float inerti[3];
float centre[3];
NewtonCollision * nCollision = NULL;
nCollision = NewtonCreateBox (m_nWorld, v_taille.x, v_taille.y, v_taille.z, NULL,NULL);
NewtonBodySetCollision(m_pBody, nCollision);
NewtonBodyGetCentreOfMass(m_pBody,centre);
NewtonConvexCollisionCalculateInertialMatrix(nCollision,inerti,centre);
NewtonReleaseCollision (m_nWorld, nCollision);
NewtonBodySetMassMatrix (m_pBody, fMasse, inertie[0],inertie[1],inertie[2]);
-
izissise
-
- Posts: 23
- Joined: Sat Jul 24, 2010 8:20 am
by PJani » Mon Sep 06, 2010 1:59 pm
izissise wrote:So, that don't work
I implanted it like that :
- Code: Select all
float inerti[3];
float centre[3];
NewtonCollision * nCollision = NULL;
nCollision = NewtonCreateBox (m_nWorld, v_taille.x, v_taille.y, v_taille.z, NULL,NULL);
NewtonBodySetCollision(m_pBody, nCollision);
NewtonBodyGetCentreOfMass(m_pBody,centre);
NewtonConvexCollisionCalculateInertialMatrix(nCollision,inerti,centre);
NewtonReleaseCollision (m_nWorld, nCollision);
NewtonBodySetMassMatrix (m_pBody, fMasse, inertie[0],inertie[1],inertie[2]);
This should correct your problems.
- Code: Select all
NewtonBodySetMassMatrix (m_pBody, fMasse, inertie[0]*fMasse,inertie[1]*fMasse,inertie[2]*fMasse); //This should work
| i7-5930k@4.2Ghz, EVGA 980Ti FTW, 32GB RAM@3000 |
| Dell XPS 13 9370, i7-8550U, 16GB RAM |
| Ogre 1.7.4 | VC++ 9 | custom OgreNewt, Newton 300 |
| C/C++, C# |
-

PJani
-
- Posts: 448
- Joined: Mon Feb 02, 2009 7:18 pm
- Location: Slovenia
by izissise » Mon Sep 06, 2010 2:07 pm
Yeah , Thank you it work !!

But I have another problem when I change an body mass to 0 other body can pass trough ....
-
izissise
-
- Posts: 23
- Joined: Sat Jul 24, 2010 8:20 am
Return to General Discussion
Who is online
Users browsing this forum: No registered users and 371 guests