Stop dialogue box flipping horizontally with characters

Announcements, support questions, and discussion for the Dialogue System.
lostmushroom
Posts: 194
Joined: Mon Jul 01, 2019 1:21 pm

Stop dialogue box flipping horizontally with characters

Post by lostmushroom »

I have a small problem that I can't figure out. When characters (player or NPCs) are horizontally flipped, their dialogue boxes flip with them, meaning the text is unreadable without a mirror :D Is there an easy way to fix this?

I'm using Corgi with the Night in the Woods style overhead bubbles.
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Stop dialogue box flipping horizontally with characters

Post by Tony Li »

Hi,

Add an Always Face Camera component. You may need to tick the Rotate 180 checkbox.
lostmushroom
Posts: 194
Joined: Mon Jul 01, 2019 1:21 pm

Re: Stop dialogue box flipping horizontally with characters

Post by lostmushroom »

Hi - to which asset should I add Always Face Camera?
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Stop dialogue box flipping horizontally with characters

Post by Tony Li »

Hi,

Add it to the bubble UI.
lostmushroom
Posts: 194
Joined: Mon Jul 01, 2019 1:21 pm

Re: Stop dialogue box flipping horizontally with characters

Post by lostmushroom »

Hey, sorry for the late reply. I didn't manage to get this working. I added the Always Face Camera component to the Speech Bubble Dialogue UI prefab and tried it with both Rotate 180 on and off. Also tried adding it to Bubble Template Menu Panel and Bubble Template Subtitle Panel. The dialogue boxes still flip with the characters.

Is there anything I might have missed?
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Stop dialogue box flipping horizontally with characters

Post by Tony Li »

Since you're using Corgi, can you untick Flip Model On Direction Change and tick Rotate Model On Direction Change?

The AlwaysFaceCamera script works with rotation, not negative scaling.

Alternatively, if you want to stick with Flip Model On Direction Change, you can add a small script to the ConversationZone child GameObject, something like this:

ConversationZoneMatchCharacterTransform.cs

Code: Select all

using MoreMountains.CorgiEngine;
using UnityEngine;

public class ConversationZoneMatchCharacterTransform : MonoBehaviour
{
    Transform characterTransform;

    void Start()
    {
        characterTransform = GetComponentInParent<Character>().transform;
    }

    void Update()
    {
        transform.localScale = characterTransform.localScale;
    }
}
In fact, I'll add this script to the Corgi integration package.
lostmushroom
Posts: 194
Joined: Mon Jul 01, 2019 1:21 pm

Re: Stop dialogue box flipping horizontally with characters

Post by lostmushroom »

Thanks for the script. I added it to the Conversation Zone prefab and it works for the NPCs, so that's great :)

Would it also work on the player character? My player prefab doesn't have a Conversation Zone, only a Player Menu Panel.
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Stop dialogue box flipping horizontally with characters

Post by Tony Li »

Yes, you can use it for anything that has a Character component in a parent object
lostmushroom
Posts: 194
Joined: Mon Jul 01, 2019 1:21 pm

Re: Stop dialogue box flipping horizontally with characters

Post by lostmushroom »

Applying it to the child objects of the Player prefab gives some scaling issues. I tried adding it to the PlayerMenuPanel and it makes the dialogue box massive. Makes sense that that would happen, but is there a workaround to get it working on the player?
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Stop dialogue box flipping horizontally with characters

Post by Tony Li »

Hi,

I just put the latest Corgi Support package on the Extras page. (direct download)

The script is named MatchCharacterDirection. It handles scaling properly with Flip On Direction Change or Rotate On Direction Change.
Post Reply