Search Unity

Spline making controls feel unresponsive.

Discussion in 'Cinemachine' started by MirzaBeig, Jan 12, 2018.

  1. MirzaBeig

    MirzaBeig

    Joined:
    Dec 27, 2014
    Posts:
    602
    Because of this:

    upload_2018-1-12_2-9-28.png

    Moving the camera back down using input is slow, and this screen was taken with the curvature turned to 0. Is there a way to space out the movement evenly?

    The free look tutorial video also had a way to change the movement to a simple lerp (using "Spine Tension"), which doesn't seem to be present anymore.

    I'm trying to build a 3rd person controller using Cinemachine (I'm assuming that's supported/recommended?), and it seems like a great fit, but a few little things here and there are getting in the way. If it's not recommended, please let me know! :)
     
    Last edited: Jan 12, 2018
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    A simple lerp is not a good solution because you will get a bump when it crosses the middle unless the top and bottom segments are exactly the same length.

    Can you show me your inspector for the Y Axis settings?
     
  3. MirzaBeig

    MirzaBeig

    Joined:
    Dec 27, 2014
    Posts:
    602
    Hey @Gregoryl, thanks for getting back to me.

    Here's a screen of the Y Axis:

    upload_2018-1-12_14-17-10.png

    Which results in this:

    upload_2018-1-12_14-17-33.png
     
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    Those settings look fine.
    How are you doing Y axis input? I don't see an axis name specified.
    I don't understand what you mean when you say "Moving the camera back down using input is slow". Can you elaborate?
     
  5. MirzaBeig

    MirzaBeig

    Joined:
    Dec 27, 2014
    Posts:
    602
    I'm setting it manually through code. Here's my code for the input:

    Code (CSharp):
    1.             mouseX = Input.GetAxisRaw("Mouse X") + Input.GetAxisRaw("Gamepad X");
    2.             mouseY = Input.GetAxisRaw("Mouse Y") + Input.GetAxisRaw("Gamepad Y");
    3.  
    4.             cmFreeLookCamera.m_XAxis.m_InputAxisValue = mouseX;
    5.             cmFreeLookCamera.m_YAxis.m_InputAxisValue = mouseY;
    Ah, to elaborate- once the camera is at the top, it's slower to move it back down because the same amount of mouse movement is "compressed" at the top of the spline while it moves quicker for the same amount when it's lower. If the movement was evenly distributed over the spline, I think it would fix this problem. It's essentially creating an easing effect which I want to avoid because it makes the input from the player feel sticky or sluggish and not as responsive as I'd like it to be.
     
  6. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    As an experiment, instead of that try putting "Mouse X" and "Mouse Y" in the Input Name field for the axes. Does that give you the right response?
     
  7. MirzaBeig

    MirzaBeig

    Joined:
    Dec 27, 2014
    Posts:
    602
    I originally had that, but I tried it again just now just to be sure after disabling the code and it's unfortunately the same result.
     
  8. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    Well, it's by design that the spacing changes in a smooth way from one end of the spline to the other, with ease in and ease out at the ends. The requirements are smooth motion, and t=0.5 corresponds to the middle rig. You can make it symmetric by placing your rigs such that the middle one really is in the middle, and not closer to the top than the bottom.
     
  9. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    You can also try turning the Accel/Decel Time down. It won't change the spacing, but it might make it a little more responsive.
     
  10. MirzaBeig

    MirzaBeig

    Joined:
    Dec 27, 2014
    Posts:
    602
    Here are two videos that I hope will help demonstrate what I mean:

    With the mouse... I'm trying to show that the same amount of movement is faster where the spheres are spaced out than the top of the curve.



    With an Xbox One controller... you can see that I'm using a constant up or down on the Y and it's slower up top.




    Even if I set them to be evenly spaced and the same size (so I get only a straight line), the distribution along the line isn't even. It's better than before, but it's still not the same as if I just programmed it myself to go between the points.

    upload_2018-1-12_15-7-24.png


    I've also set the acceleration and deceleration values to zero.

    If the player arbritrarily changes direction for Y, it'll respond faster in the center than it will at the two ends, which I don't think is ideal for what I was hoping to achieve with a really responsive camera. And it's worse the more of a curve you have.

    The smooth motion in Cinemachine is really nice! But is it possible to have an option where the distribution could be uniform? If it's against the design of Cinemachine, I'll understand. It's not too hard to code something like that seperately, but I was just trying to get acquanted with the new tools being promoted by Unity and use what's available as much as possible.
     
  11. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    I see what your'e saying. It's the way it is by design, in order to always guarantee smooth movement. If we made the change you're suggesting, we'd have to break either the smoothness requirement or the requirement that t=0.5 corresponds to the middle rig position.
     
  12. MirzaBeig

    MirzaBeig

    Joined:
    Dec 27, 2014
    Posts:
    602
    Alright, thanks for all the help and quick responses! I'll see what I can make do.