Optimizing filtering question
-
- Posts: 2
- Joined: Thu Jul 30, 2009 9:30 am
- Contact:
Optimizing filtering question
Was reading through the help and I read that the collision filter function happens after the most expensive call. My question is does the global collision filter default function happen sooner? What I want to acomplish is that things on team X only collide with things not on team X. Meaning I can't use different planes. Basically I want to do the opposite of a plane, you can collide with everything not on your plane. Is there something high level I can use to quickly abort collisions between things on the same team before any hard processing is done? Ideally maybe even before any processing is done(IE it wouldn't even do any checks vs things that are on the same team).
-
- Posts: 13
- Joined: Thu Jul 23, 2009 7:54 am
- Contact:
Re: Optimizing filtering question
I think that is what the shape group field is for... although I have not used it:
group: Shapes in the same non-zero group do not generate collisions. Useful when creating an object out of many shapes that you don't want to self collide. Defaults to 0;
group: Shapes in the same non-zero group do not generate collisions. Useful when creating an object out of many shapes that you don't want to self collide. Defaults to 0;
-
- Posts: 2
- Joined: Thu Jul 30, 2009 9:30 am
- Contact:
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: Optimizing filtering question
Yep, groups is what you want.
For the record, all callbacks are looked up at the same time. If one does not exist for the given pair, then it returns the default one. Layers and groups will cause the collision to be discarded before performing the expensive primitive check (circle to segment, poly to poly, etc). The callback is called after the primitive check happens, so you want to use layers or groups if possible then resort to the callback return value.
For the record, all callbacks are looked up at the same time. If one does not exist for the given pair, then it returns the default one. Layers and groups will cause the collision to be discarded before performing the expensive primitive check (circle to segment, poly to poly, etc). The callback is called after the primitive check happens, so you want to use layers or groups if possible then resort to the callback return value.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Who is online
Users browsing this forum: No registered users and 18 guests