I am working on a Marble Madness type game and for the movement mechanics trying to simulate the effect of moving the marble as if the player is actually tilting the ground (e.g. Tilting the ground from center along x and y axis would cause gravity to make the ball roll) but instead of actually rotating the level (ground) I want to calculate the vector for the force of gravity according to user input. I am encountering gimbal lock and do not know how to get around this. I have tried looking into quaternions and that is beyond me at this point.
How I currently have this setup:
On Tick I calculate the current X and Y angle of tilt and then rotate the vector by that rotation. So, every frame I rotating a 0,0,(Gravity) Vector.
I have recorded a video showing the resulting Gimbal Lock:
The yellow debug line represents the Force Vector, when X and Y Angles change individually it is fine but later in vid you can see how when they change simultaneously the Vector does not rotate properly.
Thank you for any possible help with this.