dialogic-godot / dialogic

💬 Create Dialogs, Visual Novels, RPGs, and manage Characters with Godot to create your Game!
https://dialogic.pro
MIT License
3.62k stars 216 forks source link

Add a very simple Bubble Layer template that doesn't move, or parameters to disable move #2247

Open hsandt opened 2 months ago

hsandt commented 2 months ago

Is your feature request related to a problem? Please describe. There is only one text Layer that tracks a character's head, which is the Bubble Layer and it's very elaborate: it has lerped motion to target, wobble and a tail.

I can use the tail, and it's easy to disable wobble by setting Wobble parameters to 0, but I can't completely get rid of the initial move. I'm working on an old school game and I want to start simple before I start adding fancy effects.

I set Behaviour Distance and Behaviour Direction to zero, but there is still some motion.

Looking at res://addons/dialogic/Modules/DefaultLayoutParts/Layer_Textbubble/text_bubble.gd > _process, the motion uses:

var direction := (base_direction + edge_influence).normalized()
var p: Vector2 = base_position + direction * (
        safe_zone + lerp(bubble_rect.size.y, bubble_rect.size.x, abs(direction.x)) * 0.4
        )

where base_direction seems normalized anyway, and edge_influence is not zero either, so there is no way to really set it to 0.

The only way I found was to change code to force set p = base_position

Not the bubble doesn't move anymore on display, but I also lost the tail completely.

Describe the solution you'd like A parameter to set to 0 or uncheck, to completely disable bubble motion.

Describe alternatives you've considered It could also be a separate layer template, but it would probably be reusing the same .gd script anyway so in both cases there'd need to be parameter-based motion in text_bubble.gd

Additional context Add any other context or screenshots about the feature request here.

The best result I got by suppressing motion, lost the tail:

image

hsandt commented 2 months ago

Ah, the solution was just below, in the lerp:

position = position.lerp(p, 5 * delta)

is a lerp toward target with hardcoded factor.

Replacing it with:

position = p

wraps bubble to target position.

So there could be an option to enable/disable smooth motion to target, as well as a tunable reverse exponential factor to replace 5 (both are useful, since to simulate insta-move we'd need a huge factor which is not elegant).