Static World & multiple materials

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Static World & multiple materials

Postby Spek » Sun Jun 07, 2009 2:47 pm

Another question for today,

Howto use multiple materials on a static mesh? So far I load my static mesh as 1 big body into the world. But as far as I know, I can only attach 1 material per body. I could divide the world into multiple bodies by sorting the whole thing on material. Or I use a special material that changes its softness/friction settings just inside the "Collision Contact" callback:
onCollisionContact( material, contact )
- Find polygon material via contact.position
- Adjust softness,elasticity,friction

But I'm not sure what would be the fastest/most friendly way. Or maybe there is also another alternative? How do you handle environments with multiple surface types (concrete, sand, ice, ...)?

Greetings,
Rick
Spek
 
Posts: 66
Joined: Sat Oct 04, 2008 8:54 am

Re: Static World & multiple materials

Postby tiresius » Fri Jul 10, 2009 5:16 pm

In my project (using 1.53) I generate separate serialized collision trees based on material and save them. The visual object is still one object. You can have many many collision trees in Newton with no slowdown whatsoever as far as I can tell.

I believe it is also possible to set UserData for each face in a single collision tree. This could capture the material type of that face and report on it when you collide with that polygon.

Hope this helps.
An apple fell on my head and I haven't been the same since...
tiresius
 
Posts: 32
Joined: Tue Nov 09, 2004 9:15 pm

Re: Static World & multiple materials

Postby Julio Jerez » Fri Jul 10, 2009 7:23 pm

Spek wrote:Howto use multiple materials on a static mesh? So far I load my static mesh as 1 big body into the world. But as far as I know, I can only attach 1 material per body. I could divide the world into multiple bodies by sorting the whole thing on material. Or I use a special material that changes its softness/friction settings just inside the "Collision Contact" callback:
...
But I'm not sure what would be the fastest/most friendly way. Or maybe there is also another alternative? How do you handle environments with multiple surface types (concrete, sand, ice, ...)?

Mutiple surface you say, ding, ding ding.

If you are not in a rush, maybe you can way for the Andvance material tutorial, I already posted the begginers package in teh wiki and I amd writing teh Doc,
You are a a more advance user but it will no harm if you chek it out, theer is a smapel with Material.

The advance materail tutourial will show in a very trivial and methodic way wil unified tehg cratetion of per shape and per face material.
There are ways of doing with the current system by I rather show the new method with the new tutorial it will now you away..
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

cron