Face NPC During Dialogue

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
pegassy
Posts: 135
Joined: Sat Mar 17, 2018 8:07 pm

Face NPC During Dialogue

Post by pegassy »

I am using UCC integration and working on a 2.5D game. My NPCs are mostly on the background, just one or two meters behind the Z axis. I would like my player character to face them while talking. Is there a way to do this simply by using the DSU integration? I know that the converse ability has features for disabling the controller and such, I was wondering if making the player character face the NPC is also possible.

Thank you.
User avatar
Tony Li
Posts: 22057
Joined: Thu Jul 18, 2013 1:27 pm

Re: Face NPC During Dialogue

Post by Tony Li »

UCC keeps a tight grip on the character's position & rotation, which is a good thing when it's controlling custom gravity, but inconvenient for dialogue. This would be a good option to add. I'll contact the developer to work up a solution.

In the meantime, you can use the SetEnabled() sequencer command. I'll assume the first dialogue entry node is spoken by the NPC. Set its Sequence to something like:

Code: Select all

SetEnabled(UltimateCharacterLocomotion, false, listener);
LookAt(speaker, listener);
SetEnabled(UltimateCharacterLocomotion, true, listener)
This will disable UCC, rotate the listener to look at the speaker, and then re-enable UCC.
User avatar
Tony Li
Posts: 22057
Joined: Thu Jul 18, 2013 1:27 pm

Re: Face NPC During Dialogue

Post by Tony Li »

Here's an updated integration package:

OpsiveUCC_DialogueSystemIntegration_2018-12-13.unitypackage

It adds a sequencer command uccLookAt(target, subject, [duration], [allAxes]). It works for all subjects, UCC-controlled or not. If the subject is omitted, it defaults to the speaker. Example:

Code: Select all

uccLookAt(listener)
The command above immediately rotates the speaker to look at the listener.

Typically the player is the listener of the first node, and the NPC is the speaker. To make the player look at the listener in this case:

Code: Select all

uccLookAt(speaker,listener)
pegassy
Posts: 135
Joined: Sat Mar 17, 2018 8:07 pm

Re: Face NPC During Dialogue

Post by pegassy »

This is wonderful Tony. Thank you for going out of your way to get an integration on this so quickly. I am very excited to try this tomorrow.
User avatar
Tony Li
Posts: 22057
Joined: Thu Jul 18, 2013 1:27 pm

Re: Face NPC During Dialogue

Post by Tony Li »

Glad to help! Opsive has already put this package (actually a slightly updated one with minor changes) on their site, too.
Post Reply