Constant Lookat() function?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
SuperSparkplug
Posts: 65
Joined: Fri Feb 06, 2015 3:51 pm

Constant Lookat() function?

Post by SuperSparkplug »

Hi there,

I was wondering, is there a way to make the LookAt() sequence command constant to follow something? As is, it only locks on to an object at a certain moment and fixes itself in place. I want for a character to come into a scene and have the player camera follow the character as he walks towards the player.
User avatar
Tony Li
Posts: 22102
Joined: Thu Jul 18, 2013 1:27 pm

Re: Constant Lookat() function?

Post by Tony Li »

Hi,

Can you use LiveCamera()?

For example, say the NPC is named Fred. This command will make the camera move in a medium shot following Fred over 3 seconds:

Code: Select all

LiveCamera(Medium, Fred, 3)
('Medium' is a camera angle defined in the default camera angles prefab.)

If you don't want the camera to move, and instead only want it to rotate to look at the NPC, then for an immediate solution you'll have to write a short custom sequencer command because the LookAt() command doesn't follow a moving target. If you need this, let me know; I can post the command script here later today. If you don't need it immediately, I'll look into making this an option in the built-in LookAt() command.
SuperSparkplug
Posts: 65
Joined: Fri Feb 06, 2015 3:51 pm

Re: Constant Lookat() function?

Post by SuperSparkplug »

Yes, I only need the camera to rotate in place to follow the position of the NPC. I kinda do need it immediately, so, if it's not too much trouble, could you give me the command?
User avatar
Tony Li
Posts: 22102
Joined: Thu Jul 18, 2013 1:27 pm

Re: Constant Lookat() function?

Post by Tony Li »

Here you go: (NEW PACKAGE) SequencerCommandLiveLookAt_2015-06-30.unitypackage

This package contains a new sequencer command: LiveLookAt(target, [subject], [duration], [allAxes])

Unlike the built-in LookAt() sequencer command, it immediately snaps to look at the target and then tracks the target for the specified duration.

Only the target is required. The other parameters are optional.
SuperSparkplug
Posts: 65
Joined: Fri Feb 06, 2015 3:51 pm

Re: Constant Lookat() function?

Post by SuperSparkplug »

Ah interesting. It works! Thanks a lot!

Also worth noting, it seems the duration is also necessary, or it will not update where the camera is pointing when the target moves. Just letting you know.
User avatar
Tony Li
Posts: 22102
Joined: Thu Jul 18, 2013 1:27 pm

Re: Constant Lookat() function?

Post by Tony Li »

Thanks for noting that. I'll change it in the next version so it immediately looks at the target even if there's no duration.
User avatar
Tony Li
Posts: 22102
Joined: Thu Jul 18, 2013 1:27 pm

Re: Constant Lookat() function?

Post by Tony Li »

Here's a link to the new LiveLookAt() that snaps to the target immediately if no duration is specified:

SequencerCommandLiveLookAt_2015-06-30.unitypackage
Post Reply