camera rotating crazily around a rolling ball on a slope

Hi i have a similar question to this here… i tried Halmato’s answer and it didnt work how i wanted it to… here’s a video about the problem: (ball physics - YouTube) i just want the camera to have a normal mouse rotation while the ball is rolling and whatever physics its doing,

@supremegamer76

Hi there,

I guess you added your camera as a child object of your player.
As your ball rotates, so does the camera
The tutorial 2D UFO covers that same problem in the video 5/9 "Following the player with the camera. (link below)

They create a code you have to add to your camera (not attached to player anymore if I remember correctly).
Not too complicated even if English isn’t your mothertongue as it is my case.

And just below the video is the code.

Hope it helped.

That happens because your camera is the child of the ball and will always stay in same position when compared to the parent object.

I would make new empty game object and script for it so it will always be exactly in same position as the ball and then make the camera child of this object. When you rotate the ball on Y-axis you should also rotate this empty parent object so it will rotate the camera. This way when the ball starts rolling the camera won’t follow it’s rotation like it does now.

In your case it seems to make sense to stop Unity from solving rotations when its rigidbody collides. In your sphere’s Rigidbody component go to Constraints and set Freeze Rotation X, Y and Z to true.
Done this you should be able to set your own rotation in your Update/FixedUpdate/LateUpdate function.