May 4, 2010 at 9:28 PM
Edited May 5, 2010 at 6:34 PM
Hi all, very happy and impressed with FP so far.
I've hit a problem that has stumped me and I've tried searching for answers to no avail, apologies if this is answered elsewhere.
I've created a pool of balls that I want to collide with each other ... and I can't make this happen. I've tried setting ball.Geom.CollisionCategories and ball.Geom.CollidesWith to CollisionCategory.All.
I just can't see the solution!
Basically in the AdvancedSamplesXNA Demos - "Demo1: Object pre-loading/caching" - (FarseerGames.AdvancedSamplesXNA.Demo1.Demo1Screen) ... how would I make the balls collide with each other?
This is the OnCollision code ... so the balls collide correctly with static rectangles (tagged as Screen1) and my actor (a little ship):
private bool OnCollision(Geom geom1, Geom geom2, ContactList contactList)
if ((geom2.Tag is Screen1) | (geom2.Tag is Border))
Ball ball = (Ball)geom1.Tag;
//Remove the collision event
geom1.OnCollision -= OnCollision;
//Disable the body
geom1.Body.Enabled = false;
//Insert the ball back to the pool
//Remove it from drawing list
//Cancel the collision since we are removing the geom from simulation.
Thanks in advance for your help.
PS - finally sorted my post out!