[HOWTO] How To: Sequencer Command To Change Original Recorded Camera Position

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
User avatar
Tony Li
Posts: 22112
Joined: Thu Jul 18, 2013 1:27 pm

[HOWTO] How To: Sequencer Command To Change Original Recorded Camera Position

Post by Tony Li »

When a conversation starts, the sequencer records the camera's original position. (Technically this happens when the first camera movement sequencer command runs.)

When the conversation ends, the sequencer moves the camera back to the original recorded position.

If you don't want the camera to return to its original position at the end of the conversation, there are two options:

1. Use MoveTo() sequencer commands to move the camera instead of using Camera() commands.

2. Or write a sequencer command that sets the original position to the camera's current position. For example

Code: Select all

using UnityEngine;

namespace PixelCrushers.DialogueSystem.SequencerCommands
{
    public class SequencerCommandSetCameraHomePosition : SequencerCommand
    {
        void Awake()
        { // (Assumes one conversation running at a time.)
            var sequencer = DialogueManager.conversationView.sequencer;
            sequencer.originalCameraPosition = sequencer.sequencerCameraTransform.position;
            Stop();
        }
    }
}
Post Reply