Search Unity

  1. The 2022.1 beta is now available for testing. To find out what's new, have a look at our 2022.1 beta blog post.
    Dismiss Notice

Cinemachine Collider - Not colliding with floor

Discussion in 'Cinemachine' started by gatzkerob, Feb 25, 2020.

  1. gatzkerob


    Jan 19, 2020

    I'm having trouble getting the Cinemachine Collider to collide with the floor.

    I'm using a FreeLook Camera. My LookAt and Follow targets are dynamic, that is when I click an object, it becomes the new LookAt and Follow target. They are stationary objects scattered throughout my scene.

    When I click an object the rig becomes attached to that object, which is what I want.

    The rig height is set to one unit above and below the selected object.

    One of my objects is level with the floor. (The floor is a cube with a box collider).

    Because the object is level with the floor, the bottom of the rig clips the floor and goes below it (Is that Ok?).

    If I move the FreeLook camera far enough on the Y-axis of the rig - below the object and floor, the Main Camera hangs on the floor for a while, then snaps below the object and the floor.

    I'm not having any issues on the walls (X-axis of the rig), even though the rig clips the walls too. It seems to only be happening on the Y-axis.

    Any Ideas?
  2. gaborkb


    Unity Technologies

    Nov 7, 2019
    I've set up a sample project similar to what you have in the image, and had no problem with collisions with the floor. The only case, which could be an exception when half of target's collider overlaps with the floor. In this case, the pull forward collider strategy cannot find a camera position, because there is no space for the camera in between the floor and the target object, so you get what you see in the image.

    Do your colliders overlap (target object's, and the floor object's)?
    Try changing your target's collider, so it is above the floor.
    Try modifying the rig, so it is not forced below the floor (if this is not what you want).
    Or try changing the Collider Strategy.

    I could not reproduce this.

    I may have misunderstood you. If yes, could you send a sample project where I can reproduce your issues?
    gatzkerob likes this.
  3. gatzkerob


    Jan 19, 2020
    Sorry for the late response,

    I figured it out. I have multiple CineMachine Cameras in my scene - one of them is a vcam for first-person movement.

    I'm using a CharacterController - attached to my Main Camera (not sure if this is the right way to do things). I don't require RigidBody at this point - just a fixed camera height with WASD movement.

    Anyway, the FreeLook camera didn't like the CharacterController, so I just disabled CharacterController via script whenever the FreeLook Camera is in use, then re-enabled it for first-person. Problem solved.

    Thank you for your efforts though.
    Wiigoof and gaborkb like this.