Beispiel #1
0
        public bool LimitsCollisionCheckWithReposition(IComponent3D component)
        {
            bool collided = false;

            if (component.Position.X < 0.1f)
            {
                Vector3 newPosition = component.Position;
                newPosition.X      = 0.1f;
                component.Position = newPosition;

                collided = true;
            }

            if (component.Position.Z > -0.1f)
            {
                Vector3 newPosition = component.Position;
                newPosition.Z      = -0.1f;
                component.Position = newPosition;
                collided           = true;
            }

            if (component.Position.Z < -Width + 2)
            {
                Vector3 newPosition = component.Position;
                newPosition.Z      = -Width + 2;
                component.Position = newPosition;
                collided           = true;
            }

            if (component.Position.X > Height - 2)
            {
                Vector3 newPosition = component.Position;
                newPosition.X      = Height - 2;
                component.Position = newPosition;
                collided           = true;
            }

            return(collided);
        }
Beispiel #2
0
        public bool LimitsCollisionCheckWithReposition(IComponent3D component)
        {
            bool collided = false;

            if (component.Position.X < 0.1f)
            {
                Vector3 newPosition = component.Position;
                newPosition.X = 0.1f;
                component.Position = newPosition;

                collided = true;
            }

            if (component.Position.Z > -0.1f)
            {
                Vector3 newPosition = component.Position;
                newPosition.Z = -0.1f;
                component.Position = newPosition;
                collided = true;

            }

            if (component.Position.Z < -Width + 2)
            {
                Vector3 newPosition = component.Position;
                newPosition.Z = -Width + 2;
                component.Position = newPosition;
                collided = true;

            }

            if (component.Position.X > Height - 2)
            {
                Vector3 newPosition = component.Position;
                newPosition.X = Height - 2;
                component.Position = newPosition;
                collided = true;
            }

            return collided;
        }