A place to discuss everything related to Newton Dynamics.
Moderators: Sascha Willems, walaber
by pHySiQuE » Mon Oct 10, 2011 1:15 pm
If I have a compound collision made of two collision objects, can I use a ConvexHullModifier on one of the collision objects, and have the compound collision affected by that? For example, if I had a compound collision made of a car body and a car door, can I use a ConvexHullModifier to rotate the car door?
I would normally use a joint in this situation, but I am just using it as an example to describe my question.
-
pHySiQuE
-
- Posts: 608
- Joined: Fri Sep 02, 2011 9:54 pm
by Julio Jerez » Mon Oct 10, 2011 4:50 pm
yes you can, it will n collide in the same frame though, but that should be ok.
-
Julio Jerez
- Moderator

-
- Posts: 12426
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by pHySiQuE » Tue Oct 11, 2011 3:44 pm
Let's say I do the following (psuedocode). Will both body0 and body1 be scaled (2,1,1) or will just body0 be affected?
- Code: Select all
collision = NewtonCreateBox(1,1,1)
body0 = NewtonCreateBody(collision);
body1 = NewtonCreateBody(collision);
collision = NewtonBodyGetCollision(body0)
modifier = NewtonCreateConvexHullModifier(collision)
float mat[16];
mat[0]=2; mat[1]=0; mat[2]=0; mat[3]=0;
mat[4]=0; mat[5]=1; mat[6]=0; mat[7]=0;
mat[8]=0; mat[9]=0; mat[10]=1; mat[11]=0;
mat[12]=0; mat[13]=0; mat[14]=0; mat[15]=1;
NewtonConvexHullModifierSetMatrix(modifier,mat)
Or is this the correct way to do this?:
- Code: Select all
collision = NewtonCreateBox(1,1,1)
modifier = NewtonCreateConvexHullModifier(collision)
body0 = NewtonCreateBody(modifier);
body1 = NewtonCreateBody(collision);
float mat[16];
mat[0]=2; mat[1]=0; mat[2]=0; mat[3]=0;
mat[4]=0; mat[5]=1; mat[6]=0; mat[7]=0;
mat[8]=0; mat[9]=0; mat[10]=1; mat[11]=0;
mat[12]=0; mat[13]=0; mat[14]=0; mat[15]=1;
NewtonConvexHullModifierSetMatrix(modifier,mat)
-
pHySiQuE
-
- Posts: 608
- Joined: Fri Sep 02, 2011 9:54 pm
by pHySiQuE » Wed Oct 12, 2011 6:20 pm
My second code is the correct usage. This is pretty cool, because you can just create a collision once and then create a collision modifier for each body you assign it to.
-
pHySiQuE
-
- Posts: 608
- Joined: Fri Sep 02, 2011 9:54 pm
by dangelo.davide » Thu Apr 26, 2012 5:30 am
Hi all,
i used to use NewtonCreateConvexHullModifier, now in news sources I cannot find that. What happened to it?
-
dangelo.davide
-
- Posts: 2
- Joined: Thu Apr 26, 2012 5:26 am
by Sweenie » Thu Apr 26, 2012 6:44 am
The colliders now have their own local matrix so ConvexHullModifier won't be necessary anymore, or rather the collision instance has it's own matrix.
viewtopic.php?f=9&t=7135&p=49134
-
Sweenie
-
- Posts: 503
- Joined: Mon Jan 24, 2005 7:59 am
- Location: Sweden
by dangelo.davide » Thu Apr 26, 2012 6:59 am
Thx a lot my friend!!! I'm using ogrenewt to integrate last newton libs with Ogre3d.
The wrapper OgreNewt is really outdated and I had deleted and commented a lot of class in the wrapper sources...
-
dangelo.davide
-
- Posts: 2
- Joined: Thu Apr 26, 2012 5:26 am
Return to General Discussion
Who is online
Users browsing this forum: No registered users and 1 guest