Guest User

Untitled

a guest
Jul 20th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.74 KB | None | 0 0
  1.                     Vector2 depth = GetIntersectionDepth(collider.m_QuadTreePosition.Rect, testCollider.m_QuadTreePosition.Rect);
  2.  
  3.                     if (depth != Vector2.zero)
  4.                     {
  5.                         float absX = Mathf.Abs(depth.x);
  6.                         float absY = Mathf.Abs(depth.y);
  7.                         if (absY < absX)
  8.                         {
  9.                             collider.m_ColliderPosition = new Vector2(collider.m_ColliderPosition.x, collider.m_ColliderPosition.y + depth.y);
  10.                         }
  11.                         else
  12.                             collider.m_ColliderPosition = new Vector2(collider.m_ColliderPosition.x + depth.x, collider.m_ColliderPosition.y);
  13.                     }
Add Comment
Please, Sign In to add comment