Search Unity

Trouble with Third Person Camera and Orbit

Discussion in 'Cinemachine' started by anthony-pinskey, Jul 23, 2018.

  1. anthony-pinskey

    anthony-pinskey

    Joined:
    Dec 23, 2016
    Posts:
    17
    Hello!

    I am trying to put together a Third Person camera that will follow my player, look at it at all times and also allow the user to orbit around the player with the mouse or right joystick.

    Very similar to these videos:





    The problem I am having is the X-Axis rotation seems to work fine, but no matter what The Y-Axis just seems to zoom in and out of my player. I am looking for just a consistent mouse orbit on both axes that are always the same distance away from the player except when a collision is detected. I started using the Free Look camera which seems to be the right option to use, but just can't find the right settings to get the look I want like in the videos above. Can this be achieved natively with Cinemachine or do I need to write some code for this as well?

    Thank you to all in advance with any input or advice!
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,710
    FreeLook is definitely the right choice for this. Sounds like you haven't set it up right. Can you post an image of your FreeLook inspector?
     
  3. anthony-pinskey

    anthony-pinskey

    Joined:
    Dec 23, 2016
    Posts:
    17
    Of course! Thanks for the rapid response! Here are the current settings of the FreeLook camera.



    Here is a video on how the camera is responding and acting strangely.

    FreeLook Issues:


    Also here is a video of the desired camera follow and look I am going for. This was from my old C# script I wrote based off some standard tutorials.

    Desired Video Example from older Script:



    Let me know your thoughts.

    Thanks again. I appreciate your time!
     
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,710
    Try setting all the composer dead zone widths/heights to 0
     
  5. anthony-pinskey

    anthony-pinskey

    Joined:
    Dec 23, 2016
    Posts:
    17
    Thanks, I tried that just now but I am still getting funky rotations and weird zooming instead of an orbit around the player.
     
  6. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,710
    Try adjusting the orbits. They define the shape of the surface over which the camera can move. By default, they're something like this (the 3 red horizontal lines and the arc connecting them. Actually the lines are really circles, but I've set up an ortho side view for clarity):

    upload_2018-7-23_16-29-56.png

    Changing the settings to this:

    upload_2018-7-23_16-36-38.png

    Results in this:

    upload_2018-7-23_16-34-57.png

    which is maybe closer to what you want. Note: my player height is 2, and the exact numbers will be dependent on your player dimensions.
     
  7. anthony-pinskey

    anthony-pinskey

    Joined:
    Dec 23, 2016
    Posts:
    17

    Thanks for posting that! I do see some improvement with that, but the rotations during orbit still seem a bit odd and uncomfortable. It's still not matching up to how it was in my original C# script or like in this video:


    I guess I may need to keep experimenting and tweaking with settings until I get the feel I want.
     
  8. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,710
    "odd and uncomfortable" doesn't help me diagnose. Can you post a video and say exactly what aspect of the movement you don't like?

    In your original script, it looks as though aim damping is being applied when you rotate the FreeLook. Most people don't like this and want a more responsive camera, so there is special code in the FreeLook to make that damping go away. If that's what you want to do, then you might need to modify some CM code.
     
  9. anthony-pinskey

    anthony-pinskey

    Joined:
    Dec 23, 2016
    Posts:
    17
    Sure thing. Let me put together a video. Thanks again!
     
  10. anthony-pinskey

    anthony-pinskey

    Joined:
    Dec 23, 2016
    Posts:
    17
    After playing around with the orbit settings more I realized what was wrong. I had the radius for all 3 rigs at different scales which kept creating some odd zooming in and out of the player at different positions. After setting all 3 of them to the same radius it feels more consistent and is always the same distance away from the player now.

    I actually accidentally had the aim damping turned on in that video in my script I shared with you and do not want that. I want a more responsive camera like you said. If I want to control the joystick sensitivity for the orbit would that just be the Accel and Decel time on each axis settings within the FreeLook inspector?
     
  11. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,710
    Accel/decel time and max speed
     
    anthony-pinskey likes this.
  12. anthony-pinskey

    anthony-pinskey

    Joined:
    Dec 23, 2016
    Posts:
    17
    Thanks again! Everything you recommended in this post has helped me tremendously. I can't thank you enough for the support and a wonderful product! I just upgraded to v2.2.0 and it is even more improved. Have a wonderful day!
     
    Adam_Myhill and Gregoryl like this.