Page 1 of 2

LookAt() does not work

Posted: Tue May 05, 2020 5:28 pm
by Edla
Another noobie question

I added the lookAt() to the sequence field of the conversation, by the player and NPC do not look at each other. From the debug info, looks like the commend does not see the player and npc transforms. Any ideas??
The following also didn’t solve it for me.
I even added in actor object to my player and set it accordingly

I also tried set the player transform to the conservation trigger

Thanks

Re: LookAt() does not work

Posted: Tue May 05, 2020 6:21 pm
by Tony Li
Try assigning the player and NPC GameObjects to the Dialogue System Trigger's Conversation Actor and Conversation Conversant. If you don't want to do that (for example, if the player is instantiated at runtime), see Character GameObject Assignments for others ways to specify the correct GameObjects.

If you set the Dialogue Manager's Debug Level to Info, when you start a conversation it will log something like this:

Dialogue System: Starting conversation 'XXX' with actor=AAA and conversant=BBB

Make sure AAA and BBB are the correct GameObjects.

If they are, then check if they have scripts that would prevent LookAt() from changing their rotation. Some character controller scripts don't let other processes change the character's rotation.

Re: LookAt() does not work

Posted: Tue May 05, 2020 7:23 pm
by Edla
Hi,
My player is instantiated at run time, its got an Dialog Actor(with Player selected in dropdown) component and a Proximity Selector assigned to it

The NPCs has the Dialog System Trigger component with the Conversation Actor assigned to None and Conversation
Conversant assigned it itself.

Here's the log when I tried to talk to them, both the conversation looks correct, but I got two different lookAt() result.
At runtime, the NPC's Dialog System Trigger component Conversation Actor is still "none", I was assuming the player will be assigned there by the system.

NPC
=====================================

Dialogue System: Starting conversation 'Get Apples', actor=NewPlayer_freelook (UnityEngine.Transform), conversant=NPC (UnityEngine.Transform).

Dialogue System: Sequencer.Play( LookAt()@0 )

Dialogue System: Sequencer: LookAt(, , 0)


NPC2
==================================================
Dialogue System: Starting conversation 'Talk to Eddie', actor=NewPlayer_freelook (UnityEngine.Transform), conversant=NPC 2 (UnityEngine.Transform).

Dialogue System: Sequencer.Play( LookAt()@0 )

Dialogue System: Sequencer: LookAt(NPC 2 (UnityEngine.Transform), NPC 2 (UnityEngine.Transform), 0)

Re: LookAt() does not work

Posted: Tue May 05, 2020 10:28 pm
by Tony Li
Hi,

Please import this patch. It should fix the issue.

DS_LookAtPatch_2020-05-05.unitypackage

This fix will also be in the next update.

Re: LookAt() does not work

Posted: Wed May 06, 2020 12:18 am
by Edla
Thanks for the fix
Some issues observed

For one of the NPC it's seems to be working as far as turning,

1. Sometimes the player does not face the NPC, it'll turn the other way, or at slight angle.
2. The NPC only seems to be rotating the collider box only, not the game object.
My NPC is only a capsule for now, to make sure it's turning, I had the game and scene running side by side, but only the collider that's set as a trigger is turning. I read LookAt() will make them face each other.
Here's some captures
https://ibb.co/pL8WGdk --> before conversation starts
https://ibb.co/1GV8R23 --> Conversation started, player faced NPC, noticed the NPC Capsule did't turn only the collider box
https://ibb.co/h78GCvd --> restated conversation at different angle, player turned but not faced with NPC, again only collider turned
https://ibb.co/HP9PN4c --> restated conversation at different angle, player turned but not faced with NPC, again only collider turned

Here's the log and it looks correct.

===================================================
Dialogue System: Starting conversation 'Talk to Eddie', actor=NewPlayer_freelook (UnityEngine.Transform), conversant=NPC Test (1) (UnityEngine.Transform).
UnityEngine.Debug:Log(Object, Object)

Dialogue System: Sequencer.Play( LookAt()@0 )
Dialogue System: Sequencer: LookAt() [speaker<->listener]


For the other NPC, both player and npc are not turning at all. Here's the debug log.

==========================================================
Dialogue System: Starting conversation 'Get Apples', actor=NewPlayer_freelook (UnityEngine.Transform), conversant=NPC3 (UnityEngine.Transform).
UnityEngine.Debug:Log(Object, Object)


Dialogue System: Sequencer.Play( LookAt()@0 )

Re: LookAt() does not work

Posted: Wed May 06, 2020 3:45 am
by Edla
Did more testing.

Looks like it's related to the conversations, not the NPC setup??
If I switch the quest around the NPCs, the NPC with the "Talk to Eddie" conversation will always trigger the LookAt() sequence and the player turned, albeit the facing problem mentioned in last post.
I compared the conversations many times, they are just simple ones with the LookAt() added to the sequence.

1. Talk to Eddie
2. Get some Apple
3. Go to Mountain.

Re: LookAt() does not work

Posted: Wed May 06, 2020 8:23 am
by Tony Li
Hi,

Can you please send a reproduction project to tony (at) pixelcrushers.com?

LookAt() just uses Transform.LookAt(). Something else on your characters may be interfering.

Re: LookAt() does not work

Posted: Wed May 06, 2020 12:25 pm
by Edla
Hi,
Currently my project is a few gig large, so I can’t email it. The player is the the Corgi topdown engine player. It uses your 3rd party code to stop it at conversation. And the NPC are just plain capsule with the dialog components on them only, no animator, no controller.

Re: LookAt() does not work

Posted: Wed May 06, 2020 4:37 pm
by Edla
I did some debugging, the reason LookAt()didn't work.
for the conversation that does not work
at the following point the m_speaker is null, therefore the DoLookAts don't execute.

Code: Select all

 
 // Handle empty args (speaker and listener look at each other):
 if ((m_speaker != null) && (m_listener != null)){
 	if (DialogueDebug.logInfo) Debug.Log(string.Format("{0}: Sequencer: LookAt() [speaker<->listener]", new System.Object[] { DialogueDebug.Prefix }));
	DoLookAt(m_speaker, m_listener.position, yAxisOnly);
        DoLookAt(m_listener, m_speaker.position, yAxisOnly);
}
 
I traced it all the way back to the the StartSubtitle() at ConversationView.cs where it sets the conversation participants
The first debug would give a runtime error, because the subtitle.speakerInfo is null.

Code: Select all

 
Debug.Log("StartSubtitle speakerInfo nameInDatabase = " + subtitle.speakerInfo.nameInDatabase + " name = " + subtitle.speakerInfo.Name + " transform name = " + subtitle.speakerInfo.transform.name );
Debug.Log("StartSubtitle listenerInfo nameInDatabase = " + subtitle.listenerInfo.nameInDatabase + " name = " + subtitle.listenerInfo.Name + " transform name = " + subtitle.listenerInfo.transform.name );

m_sequencer.SetParticipants(subtitle.speakerInfo.transform, subtitle.listenerInfo.transform);
 
I only have 3 simple conversations, only one work and the other two don't work.
I switched the convo around with different NPCs objects in the scene, and the result is the same, the one works, it works, no matter what NPC. And the other 2 failed no matter what NPC they are assigned to.
The conversation that work and does not work have the same set up, only with different words.
Is the database corrupted in anyway?? Any way to check??

Re: LookAt() does not work

Posted: Wed May 06, 2020 8:38 pm
by Tony Li
Hi,

Sorry for the late reply. Can you please email a copy of your database to tony (at) pixelcrushers.com? Please let me know which conversation works and which two don't work.

Inspect one of the misbehaving conversations in the Dialogue Editor. Click on blank canvas space to view the conversation's properties in the Inspector. Check the Actor and Conversant dropdowns. Are they correct? Do they match actors in the Actors section of the Database Editor?

Then check the <START> node and the node after. Are actors assigned to their Actor and Conversant fields?