Collision and rotating objects in unity - faking it


If you have used the physics of Unity, you might have noticed that it has some problems to correctly calculate the collision of rotating objects (especially if the pivot of the rotation is quite far away, e. g. a pendulum). I realized this when I tried to make a tiny platformer in which the only thing you can do is rotating the whole level. The objective was to move a ball towards a target area, but it was frequently flying through the (rotating) level elements.


This made the simple game idea a bit harder to solve. A not so obvious workaround was to not rotate the level. Instead, everything just stays in place, a virtual reference frame with a virtual rotation is defined and you have to fake everything else. For example, the background, the camera und the direction of gravity rotate with the virtual reference frame.

But that's not all. You also have to apply forces to the ball the create the illusion that it is moving in a rotating and accelerated reference frame. In physics, these are called ficticious forces, hence the name of the game. 3 ficticious forces are relevant in this case:

  • Centrifugal force: it keeps the ball sticking to the outer wall. You might know it from a merry-go-round at constant speed.
  • Coriolis force: it pushes the ball on a curved trajectory if the reference frame is rotating. You might know it from hurricanes.
  • I don't know if there is a specific name for the last one: it is responsible for the corresponding acceleration of the ball if the rotation of the reference frame is accelerated. You can experience it if you're in a merry-go-round that is accelerating or braking.


With all these forces correctly calculated (just stick to the formulas from a physics textbook), the illusion is complete and you can play a game with correct collisions of seemingly rotating objects (that are, in reality, not rotating at all). As long as the rotation speed is not to high, the simulation within the game is quite correct (but there are still some numerical errors; I assume that the finite length of a simulation step is the reason for this).


You can try it here in your browser: https://mattflat.itch.io/ff

Most levels show the "faked" illusion, but levels 3 and 4 show how confusing the reality in the coordinate system of Unity is. This might help to understand what is really going on to cheat Unity's physics in this 5 minute game.

Get Fictitious Forces

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.