Hi. My camera is following my player across the y axis. My player goes under 0 in the y axis, and I do not want my camera to follow him there. Ho can I set the camera’s lowest point to be y = 0?
Attach a script to the camera like this
void LateUpdate()
{
if (gameObject.transform.position.y = < 0)
gameObject.transform.position.y = 0;
}
EDIT: Thanks for pointing that out, LateUpdate is much more appropriate.
Also you could easily incorporate panning and such into the script.
Now this is a bit of a trick, but… depending on your game, you could add a Collider to the camera ![]()
Colliders are coming soon to Unity cameras @Traczy !
Check this out Cinemachine Game Rig on Vimeo the collider specific section starts at 1:30.
An upcoming version of Unity will have:
Free-Look - 3rd person AA camera control
Collider - Keep your cameras from getting tangled with objects
Cloud - Always cut to a camera with a good shot
Reactor - The ultimate driving / follow camera system
I know this doesn’t help you today… but it will be available early in the new year.