public void Update() { bulletObjects.ForEach(b => dynamicsWorld.ContactTest(b.body, b.callback)); bulletObjects.ForEach(b => b.Update()); removerDesactivados();//Al colisionar los disparos mueren, las plantan son comida y a los zombies los matan a tiros dynamicsWorld.StepSimulation(1 / 60f, 10); }
internal static List <Collision> ContactTest(CollisionObject col) { var cb = new ContactResultCallback() { colObj = col, gameObject = ((GameComponent)col.tag).GameObject, CollisionFilterGroup = col.CollisionFilterGroup, CollisionFilterMask = col.CollisionFilterMask, }; world.ContactTest(col.BulletCollisionObject, cb); return(cb.Collides); }
static void TestContactTest(RigidBody testBody, RigidBody testBody2) { object context = "your context"; ContactSensorCallback contactCallback = new ContactSensorCallback(testBody, context); world.ContactTest(testBody, contactCallback); testBody.CollisionFlags |= CollisionFlags.CustomMaterialCallback; testBody2.CollisionFlags |= CollisionFlags.CustomMaterialCallback; world.ContactPairTest(testBody, testBody2, contactCallback); testBody.CollisionFlags &= ~CollisionFlags.CustomMaterialCallback; testBody2.CollisionFlags &= ~CollisionFlags.CustomMaterialCallback; AddToDisposeQueue(contactCallback); }
public void Update() { dynamicsWorld.ContactTest(ballBody, callback); dynamicsWorld.StepSimulation(1 / 60f, 10); }