Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

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

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

  1. cddbhfweiyan

    cddbhfweiyan

    Joined:
    Jun 25, 2020
    Posts:
    1
    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:
    6,008
    CinemachineCollider should work with the ground. Can you show some inspectors, and perhaps an image of the issue?
     
unityunity