Search Unity

Collider causes camera to "jump" position

Discussion in 'Cinemachine' started by namcap, Jul 29, 2018.

  1. namcap

    namcap

    Joined:
    Jan 8, 2016
    Posts:
    49
    In a scene with lots of jagged walls (something like a cave), the FreeLook camera will jump between positions when trying to prevent occlusions with the jagged wall. The "camera radius" is set to as small as can be (0.05) without seeing inside of obstacles, but there's still some jumping. Is there any way to get the camera to slide along walls instead of jumping between positions? If I set the camera radius to 0, then no jumping occurs, but we'll also see inside of the walls.

    I attached a picture of my collider settings for reference. Thanks!
     

    Attached Files:

  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    You might have to add smoother wrapper colliders around your cave walls to reduce the jaggies. Or maybe go the other way: increase the camera radius so that it won't fit in the crevices. You might also want to bring up the DampingWhenOccluded param so that the camera returns to normal position more gradually after the obstacle is gone.
     
  3. namcap

    namcap

    Joined:
    Jan 8, 2016
    Posts:
    49
    Thanks for the response! Sadly, adding a smoother collider wouldn't be great for my use case and would be fairly expensive. Increasing the camera radius doesn't work great with the jaggies and causes it to jump around a bit more. Are there other options to play with for Cinemachine collisions?

    A simpler camera (like Unity's StandardAssets one) works better in this case, since when there's occlusion, just the Z position of the camera moves, giving it a smooth motion. Does Cinemachine have an optional strategies like this, better built to handle jaggies?
     
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    For movement only in Z, you could try setting the strategy to Preserve Height.

    Another setting you could play with is Smoothing. What that does is to resist pushing the camera back after having pulled it in, making things a little less chaotic. Combining that with well-chosen damping values might help.

    If all else fails, you could repackage the simpler collider that you like as a Cinemachine Extension and use it with the vcam.