Define MaterialGroup per Collision?

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Define MaterialGroup per Collision?

Postby Marc » Wed Jul 04, 2012 9:03 pm

I can define what objects collide with each other and which don't by setting the material group of the bodies with NewtonBodySetMaterialGroupID()

Now I was wondering, I want to have a body with 2 collisions where one collision is in another materialgroup than the other collision. I was thinking about combining them to a compoundcollision and and use that to create the body. Since materailgroups are defined per body and not per collision, this won't work.

How would I do this correctly? What I basically want is a body with 2 boxes as collisions one above the other. The upper box should collide with different stuff than the lower box. Relative to each other, those collisions shapes have fixed positions.

I thought about creating 2 bodies, one for each collision. Afterwards, connect them with some static joint that fixes them relative to each other. I'm not sure if that's the best way though.
Millenium Project Enterprises - Hobbyist Gamedev Group http://www.mpe-online.org
Walkover is now on Steam => http://store.steampowered.com/app/348700/
User avatar
Marc
 
Posts: 281
Joined: Sun Mar 14, 2004 4:07 pm
Location: Germany

Re: Define MaterialGroup per Collision?

Postby Julio Jerez » Wed Jul 04, 2012 9:23 pm

the material ID on teh body if for course resolution material pairs, it works well for small set opf material pairs,
for comples shape Bascally you need yo make a material for handling sub material shape id.
the in the call back you collect the shape ID of each shape and then you decide wht to do.

check out http://newtondynamics.com/wiki/index.php5?title=Tutorial_201:_-_Advanced_Custom_Material_System
I use similar aproach, nwo tshi soudl be way eassier by usin the use ID of the collision instance.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 0 guests