Search Unity

What is the best way to prevent camera from going into ground. Currently using: CinemachineFreeLook

Discussion in 'Cinemachine' started by ttesjt, Mar 24, 2022.

  1. ttesjt

    ttesjt

    Joined:
    Jun 25, 2020
    Posts:
    13
    Hi all.

    I am using a CinemachineFreeLook component for my game. It works great except the camera will goes into the ground if the ground behind the player is high. I am using mesh ground instead of terrain by the way.


    I tried the "Cinemachine Collider". It works well with walls but somehow cannot prevent the camera from going into the ground.

    I then tried dynamically change the value of the bottom rig of the cinemachine base on the ground height. I had some trouble accessing the rig properties.


    At this point, I am wondering what is the standard way of doing this? How to give the cinemachine camera a "collider" thing that works with the mesh ground. (if Cinemachine Colllider does the trick, then how do I configure it. I already set the layer right by the way.)


    Thank you so much, everyone!
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,728
    CinemachineCollider should work with the ground. Can you show some inspectors, and perhaps an image of the issue?
     
  3. ttesjt

    ttesjt

    Joined:
    Jun 25, 2020
    Posts:
    13
    Thank you for the reply. It's been a long time. I was pretty new to the forum so I could not find my own post and then I figured out the problem soon after the post. I then just forgot about this post.

    Thank you again for offering help!
     
    Gregoryl likes this.