Look At() for 2D

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
roxos
Posts: 3
Joined: Sat Jan 22, 2022 5:36 pm

Look At() for 2D

Post by roxos »

Hi all! In my 2D game I would like to use the LookAt() sequencer command. But the problem is that it doesn't turn the NPC all the way around (the character rotates the Y-axis by 90 and hides from view. When in fact he should be rotating 180). Haven't found how to fix this, is it possible?
User avatar
Tony Li
Posts: 22152
Joined: Thu Jul 18, 2013 1:27 pm

Re: Look At() for 2D

Post by Tony Li »

Hi,

LookAt() works in 3D by rotating the subject's transform so its forward direction faces the target.

In 2D, you can write a custom sequencer command (tutorial). There's no built-in command for 2D because direction in 2D varies quite a lot. Some projects rotate the sprite. Others set localScale.x to +1 or -1. Others set the SpriteRenderer's flipX value.
roxos
Posts: 3
Joined: Sat Jan 22, 2022 5:36 pm

Re: Look At() for 2D

Post by roxos »

Hello Tony and Thanks!
Can you tell me: is there any way to organize and group conversations in the dialog system? And does a large number of conversations affect performance (e.g. a lot of bark or small dialogs)?
Also, my game has a lot of variables (for dependencies in the story), do I need to group them?
Sorry for offtop
User avatar
Tony Li
Posts: 22152
Joined: Thu Jul 18, 2013 1:27 pm

Re: Look At() for 2D

Post by Tony Li »

Hi,

You can use forward slashes in conversation titles to group your conversations. For example, you could title your conversations:
  • Companions/Robot Butler/At Your Service
  • Companions/Robot Butler/Malfunction
  • Desert/Scavenger
  • Desert/Scorpion Herder
  • Jungle/Shaman, etc.
This will group them into submenus "Companions", "Desert", and "Jungle" in the Dialogue Editor, making it much easier to select conversations. The "Companions" submenu will have a sub-submenu for "Robot Butler".

Note that Dialogue System Triggers refer to conversations by title. If you change a conversation's title, remember to update the Dialogue System Trigger.

For other dialogue database content -- actors, quests, and variables -- you can use the Dialogue System's Asset Renamer tool. This tool will rename something in your whole project, including dialogue databases, Dialogue System Triggers in scenes, etc. (The Asset Renamer will eventually handle conversation titles, too.)

I recommend grouping everything -- quests, variables, and conversations. Common grouping approaches are by area (e.g., Village, Dungeon, Temple) or by progress (e.g., Chapter01, Chapter02, etc.).
roxos
Posts: 3
Joined: Sat Jan 22, 2022 5:36 pm

Re: Look At() for 2D

Post by roxos »

How obligatory is it to specify an actor in the dialogue system? Is it necessary to create an actor for each character with whom my player is a conversation?
User avatar
Tony Li
Posts: 22152
Joined: Thu Jul 18, 2013 1:27 pm

Re: Look At() for 2D

Post by Tony Li »

It's not mandatory. Some games just use the default "Player" and "NPC" actors for everything.

Please also see: Character GameObject Assignments.
Post Reply