Exemplo n.º 1
0
 public bool isColliding(CubeMesh other)
 {
     return(this.Position.x + this.Scale.x > other.Position.x + other.Scale.x &&
            this.Position.x - this.Scale.x < other.Position.x - other.Scale.x &&
            this.Position.y + this.Scale.y > other.Position.y + other.Scale.y &&
            this.Position.y - this.Scale.y < other.Position.y - other.Scale.y);
 }
Exemplo n.º 2
0
        public bool HasCollidedWith(CubeMesh target)
        {
            bool xHasNotCollided = this.Position.x - this.Scale.x > target.Position.x + target.Scale.x ||
                                   this.Position.x + this.Scale.x < target.Position.x - target.Scale.x;

            bool yHasNotCollided = this.Position.y - this.Scale.y > target.Position.y + target.Scale.y ||
                                   this.Position.y + this.Scale.y < target.Position.y - target.Scale.y;
            bool zHasNotCollided = this.Position.z - this.Scale.z > target.Position.z + target.Scale.z ||
                                   this.Position.z + this.Scale.z < target.Position.z - target.Scale.z;

            return(!(xHasNotCollided || yHasNotCollided || zHasNotCollided));
        }