CameraControl script, not working.

Ive tried doing this over and over again in different scripts and it still doesnt work. The ball and the camera, together, fly off the screen and i can’t control it. I don’t know what’s wrong with it.

Belongs in Scripting.

what do i need to do

Stop posting in Gossip.

For this to work the player object has to start at position 0,0,0 and the camera has to be setup where you need it.

If not you will have to calculate the offset by taking the cameras position away from the players position (or visa versa).

You should store the player Transform not it’s game object, as this is a better practice to get into when you only need the position, not the full gameObject.

The camera should follow the ball.

1 Like

thank you, but im a noob at this, and i have little to no idea of what your talking about but i tried some of what you said and it stopped flying away. but it still wont work. i want to have the ball role without the camera rolling with it. but thanks for trying. i will tell u if i figure it out.

so i will need to do
public Transform player;
before i did
public GameObject player;
?

Just use a camera follow script, Assets → Import Package → Scripts.

i cant find the import package

Is your camera a child object of the ball? The ball and camera should be separate objects. Updating the cameras position should not cause the camera to roll.

1 Like

Try checking out the learn section. They even have a project series on this topic.