Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

How to check when a LookAt Composer is properly oriented?

Discussion in 'Timeline' started by f0ff886f, Aug 12, 2019 at 3:02 AM.

  1. f0ff886f

    f0ff886f

    Joined:
    Nov 1, 2015
    Posts:
    154
    Apologies for the confusing thread title.

    I am using CineMachine with my own first person controller, right now it generally functions as a DoNothing on Aim and Follow since I take care of setting the transform directly.

    Now, I'd like a moment when my player should look at something specific. I've found that if I create a second vcam and position it in the world directly where my main vcam is, set it to LookAt the target and set its Aim to Composer, then set the priority higher than my main vcam, I get a very nice "LookAt" blend to the right orientation.

    Is there a way to get a notice when composer is actually looking at the target transform, or when that blend is complete? I tried to check for isBlending on the brain, but it returns immediately false all the time. And only the rotation is actually changing since both positions are the same.

    Otherwise, is there a way to force the composer to aim within some time limit? So when I turn on my vcam with lookAt, I know within T seconds it will be oriented properly.

    Thanks!
    Matt
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    2,725
    There is no notification when a blend finishes, but brain.IsBlending should return true while the blend is in progress. If you set up a custom blend for your LookAt vcam which lasts X seconds, then you can be sure that the blend will be finished X seconds after you activate the LookAt vcam.
     
    f0ff886f likes this.
  3. f0ff886f

    f0ff886f

    Joined:
    Nov 1, 2015
    Posts:
    154
    Do I have to wait a few frames before isBlending will be true? When is a blend "complete" in this case, when the Aim Composer has completely centered on the target?

    Thank you for the info.