Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // If the player is within the circle and their bounding box's center is
- // within 45 * 0.6 degrees from the line down the center of the opening,
- // then they are safe.
- const float InitialWheelRotation = 90.0f;
- float wheelAngleDegrees = m_wheelEntity->getRotation() - InitialWheelRotation;
- if (wheelAngleDegrees < -180.0f) wheelAngleDegrees += 360.0f;
- float playerAngleDegrees = atan2(playerCenter.y - wheelCenter.y, playerCenter.x - wheelCenter.x) * 180.0f / AGLIB_PI - 90;
- if (abs(wheelAngleDegrees - playerAngleDegrees) < 45.0f * 0.6f)
- {
- // Safe in the gap!
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement