Search Unity

Heading changes

Discussion in 'Cinemachine' started by Carpe-Denius, Nov 23, 2017.

  1. Carpe-Denius

    Carpe-Denius

    Joined:
    May 17, 2013
    Posts:
    842
    What are the settings to get the recenter heading behaviour of the last version of cinemachine?
    None of the new Binding Modes seem to do the same as the old one.

    I have a car and a camera, one of the cars children (local position and rotation zeroed out) transform to follow (with three children to look at for the different rigs)

    With the old version, I could step in the car, whichever direction the camera was facing and just hit the gas. The camera would follow the car. While changing directions, the camera would change them, too, unless I was actively looking from the sides (via axis control)

    What I currently see with heading definition position delta:
    - Lock to target on assign: just orbiting, no recentering or changing view directions at all
    - Lock to target with world up: normal orbiting, no recentering at all, view changes directly with car direction (instead of waiting for recentering)
    - Lock to target no roll: normal orbiting, recenters to some arbitrary angle (probably locks to target on assign)
    - Lock to target: same as no roll, feels like "lock to target on assign"
    - World space: recentering to arbitrary angle, feels like "lock to target on assign", but orbiting barely works
    - Simple follow with world up: recentering in the right direction, always, but orbiting has almost no effect because there are no recentering settings and it recenters instantly, probably fighting against the controller input
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    All the heading controls are still there. Only SimpleFollow does not allow you to control the heading as in that mode the heading is defined by the relationship between the camera and the target. For the other binding modes, the controls are here:

    upload_2017-11-23_19-51-5.png

    What version of Cinemachine were you using before?
     
  3. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    And in the FreeLook, they're here:

    upload_2017-11-23_19-55-27.png
     
  4. Carpe-Denius

    Carpe-Denius

    Joined:
    May 17, 2013
    Posts:
    842
    I've seen the heading settings, but most of them do not work like they are supposed to, at least according to the manual, see post 1.
    Simple follow is probably the nearest thing to the last version, but it isn't possible to change the wait time or recentering time. It recenters without the ability to control it.

    Edit: the cinemachine version before was 2.0
     
  5. Adam_Myhill

    Adam_Myhill

    Joined:
    Dec 22, 2016
    Posts:
    342
    Simple Follow is quite different from anything we had before.
    We'll go over the recenter behaviour today to ensure that it's working as designed - pretty sure it is but we will confirm.

    Is it possible there's some other differences on your side? Are you not able to get the desired behaviour with CM v2.1?
     
  6. Carpe-Denius

    Carpe-Denius

    Joined:
    May 17, 2013
    Posts:
    842
    Well, it seems to me that the recenter behaviour is at least shifted between binding modes.

    I don't think there are other differences on my side, since the only custom code is setting x and y axis values, but I'll make a fresh one with a simple demo scene this evening.

    Not related: you are the developer behind the original cinemachine, aren't you? I love it. Even with this (maybe only in my project) wrong behaviour it is still much easier to work with than without.
     
  7. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    @Carpe-Denius Could you post an image of the inspector of your vcam that's behaving wrong? Set it up the way it was before, when it was working, and post an image of that.
     
  8. Carpe-Denius

    Carpe-Denius

    Joined:
    May 17, 2013
    Posts:
    842
    This will follow a cube, wait for some time (not 0.5 seconds, but close) and then recenter to some unknown direction.

    Edit: the direction seems to be the first direction (position delta) the car has. After changing directions, it seems to recenter to the first direction instead of the current

    upload_2017-11-24_15-59-59.png
     
    Last edited: Nov 24, 2017
  9. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    @Carpe-Denius Thanks, that's a big help. What happens if you change the Heading Definition to TargetForward?
     
  10. Carpe-Denius

    Carpe-Denius

    Joined:
    May 17, 2013
    Posts:
    842
    TargetForward works as expected (at least what I expected):
    it always tries to look in the direction the object is facing, even if I rotate it at runtime via inspector.
     
  11. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    Instead of the FreeLook, can you try this experiment: use an ordinary vcam with an OrbitalTransposer having the same settings as the FreeLook. Does it follow and recenter as expected?

    When I try it I get this:
    https://www.screencast.com/t/jmk2kLZRZ
     
  12. Carpe-Denius

    Carpe-Denius

    Joined:
    May 17, 2013
    Posts:
    842
    That works, yes. If I switch between a free look cam and a standard cam with the same settings (position delta, lock to target with world up) I get the right behaviour with the standard cam and the free look cam is about 90 degrees off, which was the initial camera direction.
     
  13. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    ok so it looks like there's something screwy with the FreeLook with PositionDelta heading, that's not showing up in the Orbital alone. I noticed that if you stop moving the FreeLook target for a bit and let it settle down, then move the target, the recentering direction will pick up the new direction of motion, and hold it until motion is paused again. I'll look into what's going on there and get back to you.
     
  14. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    @Carpe-Denius Yes indeed there was a recently-introduced problem in FreeLook with PositionDelta. Thanks for your post, and for your patience!

    I have a patch for you. Please drop this into your project (replacing the old files of the same name) and tell me how it works for you.

    [Edit: updated the patch to prevent spurious stuff from showing up in rig inspector]
    [Edit2: updated again to fix non-default axis handling]
     

    Attached Files:

    Last edited: Nov 24, 2017
  15. Carpe-Denius

    Carpe-Denius

    Joined:
    May 17, 2013
    Posts:
    842
    I have more than enough patience for everyone ;)
    The new script doesn't work: orbiting now is fully inactive, regardless of the recentering settings. x axis values always resets to zero, instantly and it seems to recenter all the time now.

    Plus: the old object has now one set of settings for heading, orbits etc, if I recreate it, the binding mode, heading and recenter settings are visible on every body. X axis in those settings is editable.

    upload_2017-11-24_20-21-46.png

    The heading direction seems to be working now.
    (ignore the direction or input axis names, I made the screenshot with a new object)
     
    Last edited: Nov 24, 2017
  16. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    Extra inspector settings: yes I saw that after sending the patch, and re-upped the patch. Look at my last post and grab it again (there are 2 files now). The extra settings are gone now (in any case, they were harmless - just confusing).

    I can't repro your problem about the orbiting not working: it totally works for me: https://www.screencast.com/t/8VSE1xi7nS

    Would you mind trying it again with the new patch, and showing me the whole inspector if it still doesn't work?
     
  17. Carpe-Denius

    Carpe-Denius

    Joined:
    May 17, 2013
    Posts:
    842
    The extra settings are now indeed gone, calculating the heading works, too.

    The non-responding x-axis is still there, though. It seems that I set the wrong value (just .Value instead of .m_inputAxisValue), but it still gets reset to 0 and I can't find where that happenes...
     
  18. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    Can you show me the inspector for the FreeLook, and the bits of code where you try to set the X axis?
     
  19. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    Could it be that the BindingMode is set to SimpleFollow? That would produce the effects you are describing.
     
  20. Carpe-Denius

    Carpe-Denius

    Joined:
    May 17, 2013
    Posts:
    842
    While running playmode, I can't even change "invert axis" or "input axis name", they all get reset to the
    default values.

    Editor:
    upload_2017-11-24_21-41-38.png

    Playmode:
    upload_2017-11-24_21-42-23.png

    The Mouse X name gets reassigned, too. Could it be, that an empty object gets deserialized constantly?

    The code I was trying with the last version was
    freelook.m_XAxis.Value = freelook.m_XAxis.Value + player.GetAxis ("Camera Horizontal") * HorizontalMultiplier;

    and now I tried m_inputAxisValue instead of Value, too.


    Edit: I think I found something.
    The axis of the FreeLook gets constantly overwritten by the axis of the top rig, so my changes get discarded. CinemachineFreeLook.cs line 279
     
  21. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    Yes I see the problem. I'm on it.
     
  22. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    @Carpe-Denius Updated the patch again. Please re-fetch and give it another try. Tell me how it goes.
     
  23. Carpe-Denius

    Carpe-Denius

    Joined:
    May 17, 2013
    Posts:
    842
    Beautiful. Seems to work now. There are small differences to the old behaviour, but thats probably some wrong offset or speed setting I lost while creating a new object.
     
  24. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    Or not. The logic is different now. If you're driving the X axis value yourself then you may notice that the delay before recentering is working better. Don't dismiss any weirdnesses - this new code is very raw. Please post here if anything comes up. We really appreciate your help.
    Thanks!
     
  25. Carpe-Denius

    Carpe-Denius

    Joined:
    May 17, 2013
    Posts:
    842
    No, it definitely was my fault. I had the wrong orbit radii. Everything behaves now like I think it should. recentering delay is now the value I set instead of roughly the doubled value. Feels really smooth now.

    Thank you for your work.
     
    Gregoryl likes this.
  26. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    @Carpe-Denius Looking at this again I noticed that the patch I gave you will not produce exactly the same result as the old behaviour, due to differences in the handling of the axis accel/decel. I've fixed this locally, and will include the full fix in the next CM point release, probably later this week.