Here is what I am facing. I have a family of objects named "Discs". I want the discs to all have physics and collide and bounce off each other, except when a red disc and a blue disc collide. Then I want the one that is spinning faster to destroy the other one and continue through.
<img src="https://dl.dropbox.com/u/456685/images/PhysicsQuestion.png" border="0" />
Is there a way to detect a collision and prevent the resulting rebound?
I had a similar problem with a tank game, if you ran over the bullets, they would get stuck in your wheels. :D
You can selectively turn off collisions between certain physics objects, but they'd need to be different sprites.
So if your blue disc is turning into a red disc, you'd need to swap them out and get the newly spawned red disc to inherit the velocity / rotation of the blue disc.
I eventually decided that the work I was putting into this wasn't really worth it. I kept the bullets deflecting as they were and it's still pretty fun. It actually created a new strategy in the game where you could set up some stationary discs to defend your base.
If you destroy one sprite on collision doesn't the other sprite carry on uninterrupted?
Develop games in your browser. Powerful, performant & highly capable.
Oddly enough, no. The order of actions seems to be:
1. Physics detects collision
2. Physics are applied
3. Collision event is raised in Construct
Use colliding at offset, using the physics objects movement vector as the offset and test for collision before they collide, as it were. :)
That way you can turn off collision on the one you want destroyed.
physicsDestroy.capx (r115) In this simple example the 'destroyer' sprite never bounces off the sprites it hits for me. But maybe it depends on speed or framerate.
Maybe it is something that is fixed in the Beta release. I am running the official release path right now (so I can't open your file)