Having Issues with Vector3 distance of the camera from the object

I have put in the code in visual basics and was able to move the camera along with my car. But even after giving a desired distance from the car, for the camera, it does not make any difference.

Need help in fixing this asap.

Hi!

Can you please give us a more information? Like what exactly is going on and what were you trying to do, because I don’t see any issues with your code.

Okay, I have mentioned the issue along with the image already but ill say it again.

Right now, my camera is following the car. But the problem is that no matter negative value I give in the z coordinate in the new Vector3 (x,y,z), the cameras view distance does not change. It is stuck in a particular distance

Hi,

What do you mean by “distance”?

In “orthographic” mode, the distance between the game object and the camera does not determine how big the game object appears in the game window. If you want to zoom, you will have to change the value of the size in the Camera component. If you meant the z-position: It does not change because -10 is hard-coded in your code. The Update method will override the position values each frame.


See also:

2 Likes

thank you the issue has been solved

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms