Page 1 of 1

NPC Face player

Posted: Thu Dec 26, 2024 4:19 pm
by hrohibil
Hi Tony

I have a Dialogue System trigger on my NPC.
How do I make so if my player comes from behind that the NPC faces the player direction?

Also I am using a camera which is close up. Will I need to move this as well?

Re: NPC Face player

Posted: Thu Dec 26, 2024 7:25 pm
by Tony Li
Hi,

For a 3D game, use the LookAt() sequencer command. This rotates the subject to face the target. If you don't provide any parameters, it rotates the actor and conversant to face each other.

For a 2D game, you'll have to write your own sequencer command or handle it in a Dialogue System Events component set to OnConversationStart or use an OnConversationStart(Transform) method on the NPC. This is because 2D facing is different based on whether it's a side scroller or top down, and whether you're rotating along an axis to flip the character or setting the sprite renderer's Flip X.

Re: NPC Face player

Posted: Sat Dec 28, 2024 10:16 am
by hrohibil
Worked perfectly 👍
Thank you

Re: NPC Face player

Posted: Sat Dec 28, 2024 10:19 am
by Tony Li
Glad to help!