Hello!
When trying to focus on an object, the camera does not focus correctly if the position of the object in Y is not equal to 0. In all the demo scenes, the cubes that can be focused on have a position of 0 in Y, so everything works correctly. Question: Can you fix this? so that focusing is always correct even if Y> 0.

    Daria Hi!
    The camera is meant to be always moving on the same ZX plan, but if you want to prevent it from sticking at y=0, you can edit a few lines. For example in CameraPerspective.cs

    in the FocusCameraOnGameObject() and HandleFocusAndFollow() methods, remove or comment out these lines:
    // offseting the bounding box
    float yOffset = b.center.y;
    b.extents = b.extents.SetY(b.extents.y + yOffset);
    b.center = b.center.SetY(0);

    Please note that the camera's center point on the floor is not meant to be changed in Y, so you could have glitches.

    Hope that helps,
    Anthony

      a month later

      Hi! Just so you know, I published a new update with the ability to change the ground height, in the inspector and at runtime, check the demo scene "change_ground_height" 😉

        Write a Reply...