Example #1
0
        public PolygonMesh.PolygonMeshCollisionResult GetClosestObject(List <Object3D> ListOther, Vector3 Speed)
        {
            PolygonMesh.PolygonMeshCollisionResult FinalCollisionResult = new PolygonMesh.PolygonMeshCollisionResult(Vector3.Zero, -1);
            Object3D FinalLayerPolygon = null;

            foreach (Object3D ActiveObject3D in ListOther)
            {
                PolygonMesh.PolygonMeshCollisionResult CollisionResult = PolygonMesh.PolygonCollisionSAT(CollisionBox, ActiveObject3D.CollisionBox, Speed);

                if (FinalCollisionResult.Distance < 0 || (CollisionResult.Distance >= 0 && CollisionResult.Distance > FinalCollisionResult.Distance))
                {
                    FinalCollisionResult = CollisionResult;
                    FinalLayerPolygon    = ActiveObject3D;
                }
            }

            return(FinalCollisionResult);
        }
Example #2
0
 public bool CollideWith(Object3D Other)
 {
     return(PolygonMesh.PolygonCollisionSAT(CollisionBox, Other.CollisionBox, Vector3.Zero).Collided);
 }