Global newton material behavior

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Global newton material behavior

Postby Lax » Thu Aug 15, 2019 5:53 am

Hi,

is it somehow possible to set a global newton material behavior, that works for all physics bodies?
E.g. I'm creating material pairs for all kinds of ids: PlayerEnemyMaterialPair, PlayerFloorMaterialPair,EnemyFloorMaterialPair etc. to set NewtonMaterialSetCollisionCallback for contact behavior.

I want to remove any friction on contact via NewtonMaterialSetContactFrictionCoef.

But I have to do it for all combinations, which is I think somewhat performance critical.

Is there a way to set a global material pair, that would work for all bodies, so that I could specify such a behavior just once?

Best Regards
Lax
Please support SecondEarthTechnicBase built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd17-5ff5-40a0-ac6f-44b97b79be62
Image
Lax
 
Posts: 165
Joined: Sat Jan 08, 2011 8:24 am

Re: Global newton material behavior

Postby JernejL » Sun Aug 18, 2019 9:28 am

I don't think so, however contact callback is the best way - it is called from all process threads in parallel, so it can be really fast. I don't think you should have a performance issue with this, the callback will be real simple, too.

You can use NewtonWorldGetFirstMaterial and NewtonWorldGetNextMaterial to go thru all materials and set up callback for all of them.
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Global newton material behavior

Postby Lax » Mon Oct 28, 2019 1:11 pm

Hi JernejL,

thanks for your response. Indeed, I made some own tests and as you say performance is no issue.

Best Regards
Lax
Please support SecondEarthTechnicBase built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd17-5ff5-40a0-ac6f-44b97b79be62
Image
Lax
 
Posts: 165
Joined: Sat Jan 08, 2011 8:24 am

Re: Global newton material behavior

Postby JernejL » Tue Oct 29, 2019 9:08 am

Excellent :) good to hear you have this working!
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 11 guests

cron