public bool DetectCollision(AABB other) { //## Implement DetectCollision(AABB) ##// if (Top < other.Bottom && Left < other.Right && Right > other.Left && Bottom > other.Top) { _color = Raylib.Color.BLUE; return(true); } _color = Raylib.Color.RED; return(false); }
//detects collision using AABB public bool DetectCollision(AABB other) { //return !(_max.x < other._min.x || _max.y < other._min.y || _min.x > other._max.x || _min.y > other._max.y) //test for overlapped as it exists faster if (Right >= other.Left && Bottom >= other.Top && Left <= other.Right && Top <= other.Bottom) { color = Raylib.Color.BLUE; return(true); } color = Raylib.Color.RED; return(false); }
public bool DetectCollision(AABB other) { //## Implement DetectCollision(AABB) ##// if (Right >= other.Left && Bottom >= other.Top && Left <= other.Right && Top <= other.Bottom) { color = Raylib.Color.BLUE; return(true); } return(false); }
//Checks a collision between two AABBs public bool DetectCollision(AABB other) { if (Right >= other.Left && Bottom >= other.Top && Left <= other.Right && Top <= other.Bottom) { _color = Raylib.Color.RED; return(true); } else { return(false); } }
public bool DetectCollision(AABB other) { if ((other.Left < Right) && (other.Bottom > Top) && (other.Top < Bottom) && (other.Right > Left)) { _color = Raylib.Color.BLUE; return(true); } else { _color = Raylib.Color.RED; return(false); } }
//Draw the bounding box to the screen public override void Draw() { if (isPressed == true) { color = Raylib.Color.BLUE; } else { color = Raylib.Color.RED; } Raylib.Rectangle rec = new Raylib.Rectangle(Left, Top, Width, Height); Raylib.Raylib.DrawRectangleLinesEx(rec, 1, _color); base.Draw(); }
public bool DetectCollision(AABB other) { //## Implement DetectCollision(AABB) ##// if (((other.Left <= Right && other.Right >= Right) || (Left <= other.Right && Right >= other.Right)) && ((other.Top <= Bottom && other.Bottom >= Bottom) || (Top <= other.Bottom && Bottom >= other.Bottom))) { _color = Raylib.Color.RED; return(true); } else { _color = Raylib.Color.GOLD; return(false); } //return false; }
//detect a collision public bool DetectCollision(AABB other) { //float[] sides = { other.Right, other.Left, other.Bottom, other.Top }; //foreach (var side in sides) //{ // if (inRange(side, Left, Right, Top, Bottom)) // { // color = Raylib.Color.BLUE; // return true; // } //} //return !(Top <= other.Bottom || Bottom >= other.Top || // Left <= other.Right || Right <= other.Right); if (Right >= other.Left && Bottom >= other.Top && Left <= other.Right && Top <= other.Bottom) { color = Raylib.Color.BLUE; return(true); } return(false); }