Search Unity

FreeLookCamera not colliding/collision issue

Discussion in 'Cinemachine' started by Mars91, Jul 11, 2019.

  1. Mars91

    Mars91

    Joined:
    Mar 6, 2012
    Posts:
    391
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    2,609
    Does it still happen if you set the distance limit to 0 and the camera radius to something very small?
     
  3. Mars91

    Mars91

    Joined:
    Mar 6, 2012
    Posts:
    391
    This solved my issue. Thank you.

    I have another question.

    Is possible to create an orbit rig which is not a full sphere but just an half sphere ?
     
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    2,609
    Yes. It's not exposed in the UX, but you can set FreeLook.m_XAxis.m_MaxValue and m_MinValue to limit the viewing angle. +-180 is the default, and +-90 will give you half a sphere. Don't forget to set FreeLook.m_XAxis.m_Wrap to false as well.
     
  5. Mars91

    Mars91

    Joined:
    Mar 6, 2012
    Posts:
    391
    Thank you will give this a try.
     
  6. Mars91

    Mars91

    Joined:
    Mar 6, 2012
    Posts:
    391
    Tried with this code (inside update) but it's not working can still rotate 360° around the target.

    Code (CSharp):
    1. freeLookCam.m_XAxis.m_Wrap = false;
    2.  
    3. freeLookCam.m_XAxis.m_MaxValue = 90.0f;
    4. freeLookCam.m_XAxis.m_MinValue = -90.0f;
    EDIT: just checked the value before and after the change and I can confirm that both min and max changes but no difference in the orbit sphere.

    EDIT2: Also tried this solution with no luck.
    https://forum.unity.com/threads/limited-orbital-camera.504033/

    EDIT3: Also freeLookCam.m_XAxis.Value always return 0
     
    Last edited: Jul 11, 2019
  7. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    2,609
    ah, that's because your binding mode is SimpleFollowWithWorldUp. Change it to WorldSpace.
     
  8. Mars91

    Mars91

    Joined:
    Mar 6, 2012
    Posts:
    391
    That solved my issue, camera can now be locked but those are world value and not relative to tracked object.
    Is there some settings I need to tweak in Cinemachine or I should just do it by my self?
     
  9. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    2,609
    You can try setting the binding mode to LockToTargetWithWorldUp