godotengine / godotengine/godot

Using Tween on `global_position` and `scale` at the same time results in a completely different scale center

Open
#101,692 1 comment 0 reactions 0 assignees View on GitHub
bug topic:animation topic:gui
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

v4.3.stable.steam [77dcf97d8]

### System information

Godot v4.3.stable (77dcf97d8) - Windows 10.0.22631 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3070 (NVIDIA; 32.0.15.6094) - AMD Ryzen 5 5600X 6-Core Processor (12 Threads)

### Issue description

After modifying the pivot offset property of the Control node, theoretically, scaling should expand with the new pivot offset as the center. However, if Tween is used to modify both `global_position` and `scale` simultaneously, the `pivot_offset` is then scaled using the `(0,0)` point.

As a result, modifying `global_position` and `scale` simultaneously with Tween will behave completely differently from modifying `position` and `scale` simultaneously with Tween.

Should this be considered a bug?

### Steps to reproduce

First, change the `pivot_offset` of the `Control` node to something other than `(0,0)`
```
func go_to_global_position_and_scale() -> void:
var tween_move_and_scale = create_tween().set_parallel()
tween_move_and_scale.tween_property(self, "global_position", global_position + Vector2(1, 1), 0.5)
tween_move_and_scale.tween_property(self, "scale", Vector2(2, 2), 0.5)

func go_to_position_and_scale() -> void:
var tween_move_and_scale = create_tween().set_parallel()
tween_move_and_scale.tween_property(self, "position", position+ Vector2(1, 1), 0.5)
tween_move_and_scale.tween_property(self, "scale", Vector2(2, 2), 0.5)
```
Copy two Control nodes and try to execute the above code, result

![Image](https://github.com/user-attachments/assets/7bc3390f-daf3-4e48-ac9a-0f5f1e1412a9)

### Minimal reproduction project (MRP)

[scale_bug_mini_reproduction.zip](https://github.com/user-attachments/files/18455874/scale_bug_mini_reproduction.zip)

Contributor guide

Open the contributing guide

Research direction

Start with the attached scale_bug_mini_reproduction.zip and compare the two Control nodes using parallel Tweens on global_position and scale versus position and scale. Read the Control node's pivot_offset, position, global_position, scale, and Tween behavior, then verify the result against the reported difference in scale center.

Written by the indexing model from the issue text.

Assessment

Domain
game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.