Page 1 of 1

Seperate "LookAt" for Cameras

Posted: Tue Jan 19, 2016 7:26 am
by andrew2110
Hello!

Image

I'm trying to recreate this sort of camera effect where the subject is off-setted to a side. Just doing some experimenting in Unity, seems like I need to adjust the cameras rotation and keep the avatar looking at the cameras position.

Image

Is there a way I can make the camera lookat a child gameobject of the subject? Getting the NPC to face the camera when a conversation is active doesn't seem like it's going to be a particularly hard job

Re: Seperate "LookAt" for Cameras

Posted: Tue Jan 19, 2016 10:56 am
by Tony Li
Hi Andrew,

There are a few ways to do this. I think the easiest and most versatile is to define a new camera angle. Then you can use it for any character.

The Dialogue Manager references a Camera Angles game object (or prefab). The default Camera Angles defines angles such as Wide, Medium, and Closeup. Closeup is defined as approximately 2 units up and 1 unit away from the target:

Image

You could add another angle that's also, say, offset by 1 unit to the target's right. Say you call it "Offset Right". (There's a video tutorial link on the page linked above.)

Then you can use this sequencer command to look at the current speaker's Offset Right:

Code: Select all

Camera(Offset Right)
You could then add a Default Camera Angle component to your character. The default angle is "Closeup". Using this component, you could change it to "Offset Right". Then you can use this sequencer command:

Code: Select all

Camera(default)
If you have a giant in your game, you could define another camera angle such as "Offset Right High" that goes 4 units up instead of 2. And then you could add a Default Camera Angle component to the giant to specify that its default camera angle is "Offset Right High".

Finally, you can set the Dialogue Manager's Default Sequence to something like:

Code: Select all

Camera(default); 
Delay({{end}})
which will use the correct camera angle for each character without having to write a Sequence for every dialogue node.


BTW, you can also pass the name of an in-scene GameObject to the Camera() sequencer command, and even set the character's Default Camera Angle to it. If the Dialogue System doesn't find the name in the Camera Angles prefab/game object, it will look for the name in the scene.