Guest User

Untitled

a guest
Jun 14th, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. private function isColliding( a : GameObject, b : GameObject ) : Boolean
  2. {
  3. var collthreshSquared : Number = a.radius + b.radius;
  4.  
  5. if ( collthreshSquared < Math.abs(a._position.x - b._position.x) )
  6. return false;
  7.  
  8. if ( collthreshSquared < Math.abs(a._position.y - b._position.y) )
  9. return false;
  10.  
  11. var atob : Vec2D = a._position.subtract( b._position );
  12. var lengthSquared : Number = atob.lengthSquared();
  13. collthreshSquared *= collthreshSquared;
  14.  
  15. if ( lengthSquared > collthreshSquared )
  16. {
  17. return false;
  18. }
  19.  
  20. return true;
  21. }
Add Comment
Please, Sign In to add comment