merge compound collision on runtime

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

merge compound collision on runtime

Postby Michael » Mon Mar 15, 2010 3:24 pm

Hey guys,
i'm stuck with my compound collision, maybe you could help me easily...
I want to glue some bodies together during runtime. At the moment I am using a slider with limits, but thats no good solution.
I tried to use a compound but its not working. I can create the compound collision object, but then every single convex hull is at the same position because the information about the relative offset is lost.
The positions of those single bodies which should be attached is not known until runtime.
Can somebody explain to me how to move parts of the compound?

And, by the way, do I have to destroy the old bodies? I would like to keep them updated by Newton, as the graphics are connected to them.

thanks!
Michael
 
Posts: 5
Joined: Mon Mar 15, 2010 3:07 pm

Re: merge compound collision on runtime

Postby Michael » Mon Mar 15, 2010 4:26 pm

Ah I just found the functions NewtonCreateConvexHullModifier which is what I was looking for...
Michael
 
Posts: 5
Joined: Mon Mar 15, 2010 3:07 pm

Re: merge compound collision on runtime

Postby JernejL » Mon Mar 15, 2010 4:45 pm

Michael wrote:Hey guys,
I tried to use a compound but its not working. I can create the compound collision object, but then every single convex hull is at the same position because the information about the relative offset is lost.
The positions of those single bodies which should be attached is not known until runtime.
Can somebody explain to me how to move parts of the compound?


See: NewtonCollisionGetInfo, the m_offsetMatrix there is what you are looking for (you can call it on separate compound pieces, which can be also obtained using the NewtonCollisionGetInfo call)
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1587
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: merge compound collision on runtime

Postby Michael » Wed Mar 17, 2010 12:25 pm

yes that also works, thanks!
Michael
 
Posts: 5
Joined: Mon Mar 15, 2010 3:07 pm

Re: merge compound collision on runtime

Postby Aphex » Wed Mar 17, 2010 3:12 pm

Note that physical interactions with the moving parts will not be simulated correctly.
Aphex
 
Posts: 144
Joined: Fri Jun 18, 2004 6:08 am
Location: UK

Re: merge compound collision on runtime

Postby Michael » Thu Mar 18, 2010 4:38 pm

what do you mean?
Michael
 
Posts: 5
Joined: Mon Mar 15, 2010 3:07 pm

Re: merge compound collision on runtime

Postby Aphex » Thu Mar 18, 2010 4:46 pm

You're just moving the parts simply by changing their orientation matrix, not by using forces or imparting velocity. Physics engines can't work out correct physical interactions without these so you'd get penetrations and strange behaviour.
To get the expected behaviour you'd need to have separate bodies joined with constraints.
Aphex
 
Posts: 144
Joined: Fri Jun 18, 2004 6:08 am
Location: UK

Re: merge compound collision on runtime

Postby Michael » Thu Mar 18, 2010 5:03 pm

oh I think you got me wrong.. I just move the collision object once when I create the compound collision to fix them at the correct position. Otherwise they would all sit in the origin. I think this problem is solved (in two easy ways).
Michael
 
Posts: 5
Joined: Mon Mar 15, 2010 3:07 pm


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron