Rotating the level itself or camera and tricking the physics?

I am trying to achieve an effect in which by pressing left or right, the level rotates (gravity axis stays the same).
So as you rotate the level, a ball then reacts to the changing orientation of the level and rolls whichever way the gravity forces it to.

(I am rotating it in the inspector, transform panel for explaining purposes)
Imgur

What would be the most optimal thing to do? Rotate the level itself or rotate the camera and “trick” gravity by applying forces in whichever gravitational axis it needs, to match camera rotation? :roll_eyes:

1 Like

Updating the physics engines when moving colliders is expensive, vs updating the gravity direction. Especially if you just use Physics.gravity:

So yeah… faking it could be more efficient.

3 Likes

I agree with @lordofduct , it could be as simple as “Physics.gravity = -Camera.main.transform.up” for every frame the camera is rotating.

2 Likes