Search Unity

Resolved Look At and Aim steps are doing nothing in a certain scene, but works in a new one.

Discussion in 'Cinemachine' started by Whatever560, Dec 5, 2022.

  1. Whatever560

    Whatever560

    Joined:
    Jan 5, 2016
    Posts:
    519
    I tried all sort of configuration but it looks like I can't have my aim steps working in my cinemachine rig.

    I did a repro on a new scene with a simple camera and it's working so I guess there is something interfering in the my production scene but what ? I looked at all the components brains/extension and tried with a simple setup but it's still broken.

    Using this components :
    upload_2022-12-5_12-29-21.png

    In my old scene : here we can clearly see the look at target not beeing aimed at :
    upload_2022-12-5_12-38-56.png

    Same working setup in a blank scene :
    upload_2022-12-5_12-40-17.png

    Any insight is welcome
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,728
    Can you show the inspectors for the vcam and the target? Also please show the hierarchy, so that I can see the relationship between the main camera, CM virtual camera, and the target. And please mention which version of CM you are using.
     
  3. Whatever560

    Whatever560

    Joined:
    Jan 5, 2016
    Posts:
    519
    Hi Gregoryl, Thanks for the quick update :
    I made sure to have a very simple setup, still it's quite weird.
    Cinemachine 2.8.9
     

    Attached Files:

  4. Whatever560

    Whatever560

    Joined:
    Jan 5, 2016
    Posts:
    519
    So, I created a new vcam in the prod scene, and setting it manually and the aim works.

    So in the end it seems that there is somewhat a hidden state that stays in the "offsensiveSide" camera ( was not intended to be an offensive component though ... ahah) preventing the aim from working.

    I could step through it in the debugger if you would indicate me what to look for.
     
  5. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,728
    I'm not aware of any hidden states that would prevent Aim from working.
    I'm a little confused about what kind of camera behaviour you're looking for.
    Why are you using OrbitalTransposer?
    Why do you have LockToTargetOnAssign binding mode?
    What do you have a nonzero Bias?

    Do you have a CinemachineCollider on the vcam?
     
  6. Whatever560

    Whatever560

    Joined:
    Jan 5, 2016
    Posts:
    519
    Not sure about the Binding Mode, right now I set it to Lock To Target WithWorldUp

    Answered in the below post.

    Not in the example but I do use them in the final setup.

    ____

    I juste recreated the whole rig as I'd like to go on and it works mostly as I expect.

    I want a camera that follows a target of my choice and that orient itself in a choosen angle along the Y axis in the target space. So if the character target turns my camera is still looking at the same side of that targets (the flank for instance).

    The second thing I'd like to be able to do is to pan in the front plane of the camera (with the aim not rotating). So I was thinking of simply using the CinemachineCameraOffset on top of the rig.

    Doing so I can :
    - Choose and/or animate whichever precise rotation value I want around the target (The non zero forward bias )
    - I still can pan the camera plane (local camera XY plan).


    I tried many other solutions with framing transposer, etc but this is the closest I got to. ( and this workaround was thought because of the bug I was experiencing, but my new setup is more directed at my will : https://forum.unity.com/threads/cinemachine-3rd-person-free-rotation.1159553/#post-8634705)
     
  7. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,728
    Do you have a Camera Offset extension on the project cam? That could cause what you're seeing.
    Note on vocabulary: pan = change the Y rotation of the camera. I think you mean that you want to be able to track the camera on the XY plane?
     
    Whatever560 likes this.
  8. Whatever560

    Whatever560

    Joined:
    Jan 5, 2016
    Posts:
    519
    Mmh, sorry, bad with words, just looked them upon and you're right I'm talking about tracking the target and being able to nudge the tracking in the XY camera plane. If I change the orbital transposer tracking offset then it is changed in the target space. If I change the aim offset it pans the camera, as expected indeed.
    Hence the camera offset.
     
  9. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,728
    Right, but if you put a camera offset, it will move the camera after the aim has taken place, which will shift the target onscreen. Is that what you want?
     
  10. Whatever560

    Whatever560

    Joined:
    Jan 5, 2016
    Posts:
    519
    Yes exactly :)

    And also as additional info, my rig is not attached to the character, in which case I believe it could have been rotated with it. I'll let you know if there are some things that I didn't figure out, but it looks like I'll be able to animate the way I need.
     
  11. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,728
    So then the shift you don't like is caused by the Camera Offset. Is that correct?
     
  12. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,728
    If you want the shift to be applied before the aim, then you can change this setting to Body:

    upload_2022-12-5_9-58-17.png
     
    Whatever560 likes this.
  13. Whatever560

    Whatever560

    Joined:
    Jan 5, 2016
    Posts:
    519
    Okay, I understand you're talking about the initial issue? I cleaned everything up, but I'm pretty sure I had no camera offset at the time. The aim was not updating with a very simple setup and I can't figure out why. If I face the issue again I'll reopen this

    Yes I saw the step options on the offset component, that are a great precision. Thanks.
     
    Gregoryl likes this.
  14. Whatever560

    Whatever560

    Joined:
    Jan 5, 2016
    Posts:
    519
    Actually It seems I have way better results with putting my offset targets inside a cinemachine Target Group, using it as both follow and look at, settings rotation as manual (-90° on Y axis to get the correct side view) and playing with the weights.

    I do this instead of the camera offseting and have a correct result of the camera track from one position to the other while being able to rotate, this part was not working well with the offset setup.

    I also ended up making a modified version of the cinemachine group to allow the rotation to be an average of the elements alignment instead of their own rotation as well as allowing for an unclamped weight (from the barycentre) and allowing several tweaks on the center distribution and rotation.

    upload_2022-12-12_22-0-21.png

    I'll share the code once we're all set.
     
    Last edited: Dec 12, 2022
  15. Whatever560

    Whatever560

    Joined:
    Jan 5, 2016
    Posts:
    519
    It might be reinventing the wheel, as we could also have cameras on both targets with constraint and blend between them. Though I wanted to be able to control camera parameters differently than the actual center point of the action between the different targets.