Camera Starting under floor in game scene

Anyone knows how to fix this issue? I tried every solutions in many forum and still cannot fix this. This is the demo video of my issue: https://youtu.be/gxXfzAhaV-Y

The obvious one is to start the camera ABOVE the game floor. :slight_smile:

Camera stuff is pretty tricky… I hear all the Kool Kids are using Cinemachine from the Unity Package Manager.

There’s even a dedicated Camera / Cinemachine area: see left panel.

If you insist on making your own camera controller, do not fiddle with camera rotation.

The simplest way to do it is to think in terms of two Vector3 points in space:

  1. where the camera is LOCATED
  2. what the camera is LOOKING at
private Vector3 WhereMyCameraIsLocated;
private Vector3 WhatMyCameraIsLookingAt;

void LateUpdate()
{
  cam.transform.position = WhereMyCameraIsLocated;
  cam.transform.LookAt( WhatMyCameraIsLookingAt);
}

Then you just need to update the above two points based on your GameObjects, no need to fiddle with rotations. As long as you move those positions smoothly, the camera will be nice and smooth as well, both positionally and rotationally.

Otherwise, if you insist on persisting with your current scripting, then it simply sounds like you wrote a bug… and that means… time to start debugging!

By debugging you can find out exactly what your program is doing so you can fix it.

Use the above techniques to get the information you need in order to reason about what the problem is.

You can also use Debug.Log(...); statements to find out if any of your code is even running. Don’t assume it is.

Once you understand what the problem is, you may begin to reason about a solution to the problem.

Thanks for your reply! I’m new to Unity, and this is my first project developing for VR. I tried positioning the camera above the game floor, but when I start the game, it still appears under the floor :sweat_smile: I’ll definitely try your suggestion—thank you so much!