Search Unity

  1. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Let us know a bit about your interests, and if you'd like to become more directly involved. Take our survey!
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Free look camera with world space binding and overriden world up

Discussion in 'Cinemachine' started by Molioo, Oct 3, 2018.

  1. Molioo

    Molioo

    Joined:
    Mar 12, 2016
    Posts:
    2
    Hello,
    At start I have to say that i am pretty amateur with cinemachine.

    In my game I am using Free look camera with world space binding and it works great when player is walking on the normal ground like floor.
    When player is moving forward, he's moving in camera.forward direction, if he's moving right, he goes in camera.right direction etc.
    I also have this situations where player can walk on the walls and his "up" is parallel to wall normal.
    In this case world space binding isnt working as camera orbits are placed with world up and not player up. It is so even if I have correct (same as player) World Up Override in Cinemachine Brain.

    Camera is working good (it has player up) on walls when it's set to Simple Follow With World Up and Lock To Target With World Up but with these setups, my player movement isn't working good.

    Camera Screen X i set to 0.4 and Screen Y is set to 0.65. My player movement is depending on camera rotation.

    In world space binding when I run forward, camera position relative to player isnt changing, but in simple follow with world up its changing and goes to left. That causes that camera rotation goes to right and player is slowly going forward-right. Also going right or left only doesnt work good.
    In Lock To Target binding when I run forward with camera directed to forward its ok but when I move my mouse to right or left and camera isnt directed in player forward, my player starts to run in circles.

    Is there something I can do to have my free look camera behave like it's set to world space binding but also tolerating player up being different than world up?

    It's pretty hard for me to explain it, I hope You can somehow understand this.
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    1,636
    These kinds of things are very difficult to describe. Posting a little video is often helpful, and images of the inspectors. I think the whole thing is summed up in your last sentence, right?

    Setting the world up override in the brain would be my first instinct, but you say it's not working the way you need. Have you tried LockToTarget binding mode? That might give you the right FreeLook orbits, but you'll have to do a little work to get the player's forward to always match camera forward. Leaving aside for now the problem of player movement, what happens when you try that?

    What version of CM are you using?
     
  3. Molioo

    Molioo

    Joined:
    Mar 12, 2016
    Posts:
    2
    I am using CM 2.2.7.

    When binding is set to WorldSpace it looks like this (even with world up override is set):
    https://imgur.com/cFcr0VF
    Setting LockToTarget binding mode creates correct FreeLook orbits,same as LockToTargetWithWorldUp( when world up override is set).

    When it's set so, it looks like this:
    https://imgur.com/2qKKHgH
    My movement works best with WorldSpace and I was hoping that maybe there is some way to use it in also in case when player is i.e. on wall.
     
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    1,636
    If you want the camera orbits to be right, you can't use world space. You have to use one of the other modes. I recommend LockToTarget, because it's simpler. So now it's just a question of getting the movement right.

    The difficulty will be the X axis. Maybe you can try this:

    Leave the Y axis on the FreeLook alone, but disconnect the mouse X from the X axis. Put nothing as the axis name. Then, add a little script to the player to turn it left/right (player-local) in response to mouse X. Camera will automatically follow. This should behave the same as world binding did.