Exemplo n.º 1
0
        //Determine if an internal object has hit the wall of an eclosing object         //Determine if an internal object has hit the wall of an eclosing object
        public bool InternalCollision(cls3DObject otherModel, int scalar)
        {
            if (otherModel.isVisible())
            {
                BoundingBox tester = boundingBox;
                tester.Max += Velocity*scalar;
                tester.Min += Velocity*scalar;

                if (tester.Max.X > otherModel.boundingBox.Max.X
                    || tester.Max.Y > otherModel.boundingBox.Max.Y
                    || tester.Max.Z > otherModel.boundingBox.Max.Z
                    || tester.Min.X < otherModel.boundingBox.Min.X
                    || tester.Min.Y < otherModel.boundingBox.Min.Y
                    || tester.Min.Z < otherModel.boundingBox.Min.Z)
                    return true;
            }
            return false;
        }
Exemplo n.º 2
0
        //Determine if a collision between two objects has been made c
        public bool ExternalCollision(cls3DObject otherModel, int scalar)
        {
            if (otherModel.isVisible())
            {
                BoundingBox tester = boundingBox;
                tester.Max += Velocity * scalar;
                tester.Min += Velocity * scalar;

                if (tester.Intersects(otherModel.boundingBox))
                    return true;
            }
            return false;
        }