Page 1 of 1

Lock Bark UI position and rotation?

Posted: Thu Feb 02, 2023 10:24 pm
by lcn_mc
Hello, all.

Running into an odd issue with Barks and am looking for ideas. Here's the problem:
  • I'm using barks in a 2D, top-down game.
  • I have the Basic Standard Bark UI prefab as a child object to a NPC game object.
  • The NPC has a simple Playmaker action that has it walk back and forth and face in the direction it's walking.
  • When the Bark is triggered, the Bark UI panel will inherit its rotation and position from the NPC game object, which means the Bark UI panel will be above the NPC when it moves to the right, below the NPC when it moves to the left, and will sometimes overlap the NPC when the NPC is rotating to change direction.
I would like the Bark panel to always be above the NPC's center point, regardless of which way the NPC game object is facing.

I've looked through the Bark documentation, the game object, and its Panel child object, and I can't see any obvious setting to prevent this behavior.

Ideally, the Bark Panel would be based on the NPC game object's X/Y position and not care at all about its current rotation.

Is there any way to achieve this?

Thanks for the help.

LCN

Re: Lock Bark UI position and rotation?

Posted: Fri Feb 03, 2023 8:00 am
by Tony Li
Hi,

Here are two suggestions:

1. You could structure your NPC like this:
  • Top-level GameObject: moves but doesn't rotate/flip
    • Model/Sprite: Rotates/flips when NPC turns
    • Bark UI
This way when the NPC turns it won't affect the world space bark UI.

2. Alternatively, you could use a screen space bark UI and the UISmoothFollow script in "UI Smooth Follow" package (download) on the Dialogue System Extras page. This will move the bark UI to follow the GameObject without affecting its rotation.

Re: Lock Bark UI position and rotation?

Posted: Fri Feb 03, 2023 2:13 pm
by lcn_mc
Tony,

Thanks for the suggestions. I had considered something to similar to your first suggestion, so I'll investigate that a bit more.

I'll also take a look into the UI Smooth Follow package, thanks for the tips.

If all else fails, I'll likely arrange the bark occurrences in such a way that they can't occur unless the NPC is in a specific position with a specifically-positioned Bark UI panel.

Appreciate the help as always, Tony.

Re: Lock Bark UI position and rotation?

Posted: Fri Feb 03, 2023 2:21 pm
by Tony Li
Glad to help!