public bool IsColliding(Entity a, Entity b) { WrapperPhysic wrapperA = _container[a]; WrapperPhysic wrapperB = _container[b]; return(wrapperA.IsColliding(wrapperB)); }
public List <Entity> GetEntitiesWhichCollidesWith(Entity e) { WrapperPhysic subject = _container[e]; List <Entity> collidesWith = new List <Entity>(); foreach (WrapperPhysic wp in _container) { if (wp != subject && wp.IsColliding(subject)) { collidesWith.Add(wp.Entity); } } return(collidesWith); }
public override bool IsColliding(WrapperPhysic other) { BoundingSphereWP otherEntity = (BoundingSphereWP)other; for (int i = 0; i < this.Model.Meshes.Count; i++) { BoundingSphere c1BoundingSphere = this.Model.Meshes[i].BoundingSphere; c1BoundingSphere.Center += this.Entity.Position; for (int j = 0; j < otherEntity.Model.Meshes.Count; j++) { BoundingSphere c2BoundingSphere = otherEntity.Model.Meshes[j].BoundingSphere; c2BoundingSphere.Center += otherEntity.Entity.Position; if (c1BoundingSphere.Intersects(c2BoundingSphere)) { return(true); } } } return(false); }
public abstract bool IsColliding(WrapperPhysic other);