floating text affected by scale and rotation of a parent

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By dearme

I have a floating text node (parent: node2d, child: label) that basically pops up when bullet hits the target. The enemy in this case spawns these texts to indicate the damage done to it.

The problem is that the enemy’s rotation is affected by players position. As well as the enemy’s scale Y is changed to flip the enemy depending on players position… Together with the enemy scale and rotation - floating text is also affected.

Is it possible for the floating text to not have the scale and rotation affected by the parent nodes modifications, but keeping the relative position to enemy’s pivot?

Basically I want the floating text to live it’s own life but sill be pivoted to the center of the enemy.

I am using the _Ready function in combination with Tweens to animate the floating text

public override void _Ready()
{
    var label = GetNode<Label>("Text");
    label.Text = Text;

    label.Scale = new Vector2(0.3f, 0.3f); 

    var creationTween = CreateTween();
    creationTween.TweenProperty(label, "scale", new Vector2(1, 1), 0.2f).SetTrans(Tween.TransitionType.Bounce);

    creationTween.TweenProperty(label, "modulate", new Color(1, 1, 1, 0), 0.4f);
    creationTween.TweenCallback(new Callable(this, nameof(OnFadeOutComplete)));
}

private void OnFadeOutComplete()
{
    QueueFree();
}
:bust_in_silhouette: Reply From: Moreus

I think easiest way to do it is with use RemoteTransform2D(or 3D) and separate your text from parent.