Rogue body and collision detection

Discuss new features and future development.
Post Reply
kandkstuart
Posts: 29
Joined: Thu Jan 12, 2012 10:08 pm
Contact:

Rogue body and collision detection

Post by kandkstuart »

I need to use rogue bodies to move objects I don't want controlled by chipmunk but I need to have collision detection possible with the rogue bodies. Is this possible? And if so how would one accomplish it if the rogue bodies are part of the space?

Thanks for any help!
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Rogue body and collision detection

Post by slembcke »

When you say "collision detection" which do you mean? That callbacks should be called or that there should be a collision response?

Collisions are not detected at all between infinite mass objects (so no callbacks or response). If you changed it so that it did you would have to make sure to return false from the the begin or preSolve callbacks to avoid an unsolvable collision. Working with finite mass rogue bodies is not really recommended. You'd really have to know what you are doing.

Collisions between infinite mass and finite mass bodies (rogue or otherwise) works normally.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
kandkstuart
Posts: 29
Joined: Thu Jan 12, 2012 10:08 pm
Contact:

Re: Rogue body and collision detection

Post by kandkstuart »

I guess I'm trying to figure out the best way to move an object myself but use chipmunks collision detection for that object. I have a pathfinding AI that moves my enemy objects so I don't need chipmunk to do that work but I would like chipmunk to detect when the enemy objects collide with other objects. What would you suggest? Things I have tried haven't been successful.
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Rogue body and collision detection

Post by slembcke »

Hmm. It sounds like maybe you just want sensor shapes?
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
kandkstuart
Posts: 29
Joined: Thu Jan 12, 2012 10:08 pm
Contact:

Re: Rogue body and collision detection

Post by kandkstuart »

Do you have a link to an example of sensor shapes somewhere?
kandkstuart
Posts: 29
Joined: Thu Jan 12, 2012 10:08 pm
Contact:

Re: Rogue body and collision detection

Post by kandkstuart »

I see you just set a flag. By setting the Sensor flag that shape can be moved manually without impact from Chipmunks perspective? Oh ya, will chipmunk detect a collision between the same object if given a callback routine?
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Rogue body and collision detection

Post by slembcke »

Yep, sensors are for collision shapes where you want callbacks but no collision response. Basically the same as if you returned false for the preSolve callback each time.

One problem that I noticed a day or two ago is that collisions between infinite mass objects is filtered out before even calling the callbacks. So don't make infinite mass sensor objects. I intend to change it to work like sensors instead though.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
kandkstuart
Posts: 29
Joined: Thu Jan 12, 2012 10:08 pm
Contact:

Re: Rogue body and collision detection

Post by kandkstuart »

that does the trick! Thanks as always!
Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests