Search Unity

  1. Check out the Unite LA keynote for updates on the Visual Effect Editor, the FPS Sample, ECS, Unity for Film and more! Watch it 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. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    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

Cinemachine Free Look - How to achieve linear speed for Axis Controls?

Discussion in 'Cinemachine' started by xDavidLeon, Aug 30, 2018.

  1. xDavidLeon

    xDavidLeon

    Joined:
    Jun 9, 2014
    Posts:
    78
    Hi there,

    Cinemachine is an amazing tool, but I'm having issues achieving some basic functionality that can be done with very simple alternatives.

    The first issue is that I can't find a way to get linear camera velocity when moving the camera vertically around the target.

    With the Free Look component, the Y axis, which goes from 0 to 1, defines the vertical positioning of the camera. So, 0 places the camera at the Bottom Rig position, and 1 places it at the Top Rig position. The issue is that when I move the controller / mouse down or up, the camera velocity will differ depending on the distance between the rigs.

    Using this extreme example:


    The camera will move way faster from the top rig to the middle rig than from the bottom rig to the middle rig, and that makes the camera feel really clunky when playing.

    The 2nd big issue is the way the spline works here. When the camera travels to the bot rig position I would expect it to use the Bottom rig position as the lowest Y position in its path, but as you can see in the screenshot this is far from reality.

    If you could shed some light into these issues I would be super happy.

    Kind Regards,
    - David L
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    1,738
    The first problem is due to the 0 value of the Y axis corresponding to the middle orbit, and the fact that the camera has farther to travel on the top portion of the spline. Axis velocity is in Axis units per second, not distance per second. One way out is to try to make the path lengths of both halves of the spline approximately the same, by placing the middle orbit closer to the middle, and not so close to the bottom. Another possible solution is to have a middle-man script driving the axis. Add a script to manipulate the Y axis value in a custom manner.

    For the second thing, I think it's just spline tension. Have you tried lowering it?
     
  3. xDavidLeon

    xDavidLeon

    Joined:
    Jun 9, 2014
    Posts:
    78
    Hey Gregoryl,

    Yes, I figured that the 1st issue is part of how the Free Look Camera works. Making both halves of the spline similar in length beats the purpose of the tool from a UX perspective; I tried it anyway and gave me other issues, since then I cannot define the exact height/radius of the orbit centered around the player's head (what should be the mid orbit). I was also trying to find a way to redefine the spline by hand with no success. I'm really surprised that nobody else has given any feedback regarding vertical camera movement/speed.

    I ended up coding my own gameplay free look cam, and using a Cinemachine External Camera to make it play nice with the rest of Cinemachine virtual cameras.

    Thanks
     
  4. Adam_Myhill

    Adam_Myhill

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    311
    Hi @xDavidLeon glad to hear you're up and running. I'd be really happy to hear what you did in your custom FL version. Was it just

    - Head orbit radius
    - Crafting new spline shapes?

    We are working on FreeLook2 which is getting close to ready and I'd like to make sure it addresses as many issues/features as makes sense. Would love to know what you did on your specific FL.
     
  5. xDavidLeon

    xDavidLeon

    Joined:
    Jun 9, 2014
    Posts:
    78
    I'm attaching the package with the GameObject structure for the camera rig, and my FreeLookCam script. You'll probably need to remove some lines referencing my Rewired input implementation etc.

    The usual config uses only 2 GameObjects.
    1. CameraRig prefab with the FreeLookCam script.
    2. Camera GameObject with Cinemachine Brain and Cinemachine External Camera component.
    Let me know if you have any issues.
     

    Attached Files:

    Adam_Myhill likes this.
  6. Adam_Myhill

    Adam_Myhill

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    311
    Awesome, thanks for sharing. Very much appreciated.