Hi Tony, have a bit of a question for you. I'd like to set an animation on a separate gameobject to trigger once I hit a certain point in a conversation. My character Shirley will force a tree to disappear after a dialogue node with the boolean Shirley.tree set to true. At which point, the prioritycamera will focus on the tree as it fades for maybe 3 seconds, and the gameobject is disabled afterward. I'm not entirely certain where the sequence would go. In the dialogue node? On the tree itself? How is the dialogue sequence supposed to trigger the other gameobject to do these things?
Thanks ahead of time Tony.
Sequence in dialogue triggering animation on another object
-
- Posts: 34
- Joined: Mon Dec 30, 2019 4:26 pm
Re: Sequence in dialogue triggering animation on another object
Hi Chris,
Use the dialogue entry node's Sequence.
For example, let's say the tree's GameObject is named "Maple Tree". It has an Animator with an animator state named "Disappear". Set the Sequence field to something like:
AnimatorPlay() finds the GameObject named "Maple Tree" and tells its Animator to play the state named "Disappear". Delay(3) stays on that dialogue entry node for 3 seconds before progressing to the next stage of the conversation.
The AnimatorPlayWait() command, on the other hand, waits for the animator state to finish. You could do this instead:
Since you mention a prioritycamera, it sounds like you're using Cinemachine. You can use the CinemachinePriority() command to set the priority of a vcam. For example:
The first line sets the priority of "Tree vcam" to 999.
The second line plays the disappear animation. When it's done, it sends the sequencer a message "TreeDisappeared".
The third line waits until the sequencer receives the message "TreeDisappeared". Then it sets the Tree vcam's priority back down to zero.
Use the dialogue entry node's Sequence.
For example, let's say the tree's GameObject is named "Maple Tree". It has an Animator with an animator state named "Disappear". Set the Sequence field to something like:
Code: Select all
AnimatorPlay(Disappear, Maple Tree);
Delay(3)
The AnimatorPlayWait() command, on the other hand, waits for the animator state to finish. You could do this instead:
Code: Select all
AnimatorPlayWait(Disappear, Maple Tree)
Code: Select all
CinemachinePriority(Tree vcam, 999);
AnimatorPlayWait(Disappear, Maple Tree)->Message(TreeDisappeared);
CinemachinePriority(Tree vcam, 0);@Message(TreeDisappeared)
The second line plays the disappear animation. When it's done, it sends the sequencer a message "TreeDisappeared".
The third line waits until the sequencer receives the message "TreeDisappeared". Then it sets the Tree vcam's priority back down to zero.
-
- Posts: 34
- Joined: Mon Dec 30, 2019 4:26 pm
Re: Sequence in dialogue triggering animation on another object
Hi Tony, thanks a lot, that worked! For future reference, do you have a documented list of all the sequencer commands with explanation? And is referencing a separate object generally in the 2nd spot in parenthesis on other sequencer commands (if it's being used)?
Thanks again
Thanks again
Re: Sequence in dialogue triggering animation on another object
Yup!
- Cutscene Sequences (main page)
- Sequencer Command Reference