protected virtual void CallOnIntersection(PhysicModel arg1) { if (OnIntersection != null) { OnIntersection.Invoke(this, arg1); } }
public virtual void Update(GameTime gameTime) { //Update meta objects RigidBody[] rigidBodyArray = rigidBodies.ToArray(); foreach (MetaObject b in metaObjects) { b.Update(gameTime, rigidBodyArray); } //Update bodies foreach (RigidBody b in rigidBodies) { b.Update(gameTime); } //Check for interactions for (int i = 0; i < rigidBodies.Count; i++) { for (int j = i + 1; j < rigidBodies.Count; j++) { //Check low-level if (LowLevelCollision(rigidBodies[i], rigidBodies[j])) { //Check high-level IntersectionData intersectionData; if (rigidBodies[i].CollisionPolygon.IntersectingPolygon(rigidBodies[j].CollisionPolygon, out intersectionData)) { //Invoke event OnIntersection.Invoke(this, new IntersectionEventArgs(rigidBodies[i], rigidBodies[j], intersectionData)); } } } } }
private void CheckIntersection() { for(int i = 0; i < intersectionTime.Count; i++) { if(t / time > intersectionTime[i]) { if (OnIntersection != null) OnIntersection.Invoke(); intersectionTime.RemoveAt(i); i -= 1; } } }
protected virtual void CallOnIntersection(PhysicsModel arg2) { OnIntersection?.Invoke(this, arg2); }