/// <summary> /// Collision happened /// </summary> /// <param name="sender"></param> /// <param name="other"></param> /// <param name="pair"></param> void Events_InitialCollisionDetected(BEPUphysics.Collidables.MobileCollidables.EntityCollidable sender, BEPUphysics.Collidables.Collidable other, BEPUphysics.NarrowPhaseSystems.Pairs.CollidablePairHandler pair) { IObject send = BepuEntityObject.RecoverObjectFromEntity(sender.Entity); IObject obj = BepuEntityObject.RecoverObjectFromCollidable(other); ///Verifica se esta bola ja foi considerada ///Consider just the first collision if (alreadProcessed.Contains(obj.GetId())) { return; } alreadProcessed.Add(obj.GetId()); ///se o objeto colidido for diferente do cenario ///dont consider the island model (triangle meshes in general) if (obj.PhysicObject.PhysicObjectTypes != PhysicObjectTypes.TRIANGLEMESHOBJECT) { shouldDraw = true; ///Envia uma mensagem para o canal de comunicacao CUBO ///Send a message to the channel Message m = new Message(send.GetId(), PrincipalConstants.InvalidId, "cubo", Priority.MEDIUM, -1, SenderType.OBJECT, null, "CHANGECOLOR"); MessageDeliver.SendMessage(m); ///Esta mensagem foi enviada sem Sender (Quem receber a mensagem nao sabera quem enviou) ///Envia uma mensagem para o "CUBO QUE VAI MUDAR DE COR" (lembre que o id dele eh 77 !!) ///Send a message to the specific id (first cube) m = new Message(PrincipalConstants.InvalidId, 77, null, Priority.MEDIUM, -1, SenderType.OBJECT, null, "CHANGECOLOR"); MessageDeliver.SendMessage(m); } objNameTemp = obj.Name; }
void detectorVolume_VolumeStopsContainingEntity(DetectorVolume volume, BEPUphysics.Entities.Entity entity) { contactEntity = BepuEntityObject.RecoverObjectFromEntity(entity); evt.Code = FireEndsContaining; evt.FireEvent(this); }
void detectorVolume_EntityBeginsTouching(BEPUphysics.Entities.Entity toucher, DetectorVolume volume) { contactEntity = BepuEntityObject.RecoverObjectFromEntity(toucher); evt.Code = FireBeginsTouching; evt.FireEvent(this); }