How to freeze rotation of the camera

Hello everyone. I have a problem about rotations of my camera. I have a cannon and it fires a ball. And I want my camera to follow the fired ball, and watch where the ball hits. So I did something like that :

var newBall = Instantiate(ball,ballSpawn.transform.position,ballSpawn.transform.rotation);
newBall.rigidbody.velocity = ballSpawn.transform.TransformDirection ( Vector3.forward * power * Time.deltaTime * 100 );
cameraObject.transform.parent = newBall.transform;

it works, but when the ball hits the floor, ball starts to roll. ( it’s a simple sphere with rigidbody ) So as long as ball rolls, camera rolls to. What I want is, camera will not change it’s position according to the instantiated ball object, it’ll just follow it. Any ideas ? Thanks :slight_smile:

You are passing the whole transform,

cameraObject.transform.parent = newBall.transform;

using parent is making it a child so it inherits all transform.

You could instead get the camera and simply alter the position

cam = GameObject.Find("MainCamera");
cam.transform.position = newBall.transform.position;