collision filtering and collision flags

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

collision filtering and collision flags

Postby domdom » Sun Sep 22, 2013 2:07 pm

Hi,

I'm new to Newton and I'm having a hard time figuring out if the engine has some sort of collision "filter", kind of like what box2d offers with fixtures, and that allows to make groups of objects that can collide together or not and to specify collision flags and filters ( http://www.iforce2d.net/b2dtut/collision-filtering ).
I have looked at the materials in Newton, but they do not seems to offer the same array of possibilities.
Am I missing something or is there no equivalent?

Thanks.
domdom
 

Re: collision filtering and collision flags

Postby Julio Jerez » Sun Sep 22, 2013 3:10 pm

In newton the Material system is a Graphs, where nodes are material and the edges between nodes are the material interactions.

on initialization, In the material graph you add interaction pair by pair, for example concrete-wood, steel-wood, ...
each pair you set the material default property, and you pass a function callback.
In the call back you can store any king of information you want, including the so call collision flags use but pseudo physics libraries.

when you make a body you assign a material node ID. (concrete, wood, steel , etc)
this id point to a node in the material graph

then when two bodies AABB come close you get the AABB callback, when you can check the flag the you stored on your data structure, and you return 1 or 0 if you depending of what your flag decide.

if you return 1, then the body pair is considered for contact calculation.
after contact calculation you get the second callback with a contact joint, at the stage you can still reject some of all contacts.

there are examples of all of this in all of the demos.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: collision filtering and collision flags

Postby JoeJ » Sun Sep 22, 2013 3:53 pm

Because it took me a while to find the callback name in newton.h, here some link:
http://newtondynamics.com/wiki/index.php5?title=NewtonOnAABBOverlap
User avatar
JoeJ
 
Posts: 1489
Joined: Tue Dec 21, 2010 6:18 pm


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron