godotengine / godotengine/godot
Scaling a Node3D with Physics Interpolation active shows incorrect scale for 1 frame, when using Tween
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
- v4.4.dev.custom_build [4254946de]
### System information
Windows 10 - Vulkan
### Issue description
Using Tween to scale a Node3D when coming from a different visibility state will display the wrong scale for at least 1 frame.
For example: a MeshInstance3D is hidden at the start with a scale of (1,1,1), a tween is used to show the mesh (order doesn't change it) then scale it from (0,0,0) to (1,1,1) - for at least 1 frame it will display the original scale of (1,1,1).
Tween's `set_process_mode` doesn't change the behaviour. Physics Interpolation has to be ON for the bug to occur.
### Steps to reproduce
3D scene with a camera and a MeshInstance3D
```gdscript
extends Node3D
@onready var mesh: MeshInstance3D = $MeshInstance3D
func _ready() -> void:
mesh.hide()
var new_tween: Tween = create_tween()#.set_process_mode(Tween.TWEEN_PROCESS_PHYSICS) # Bug occurs in both process modes
new_tween.tween_interval(1.0) # Let scene be visible
# Example 1
new_tween.tween_callback(mesh.show)
new_tween.tween_property(mesh, "scale", Vector3.ONE, 2.0).from(Vector3.ZERO)
# Example 2 (comment 2 lines above and uncomment next line)
#new_tween.tween_callback(show_and_scale)
# Example 2
func show_and_scale() -> void:
mesh.show()
mesh.scale = Vector3.ZERO
var new_tween: Tween = create_tween()
new_tween.tween_property(mesh, "scale", Vector3.ONE, 2.0) # ".from_current()" also shows bug and ".from(mesh.scale)" also
```
### Minimal reproduction project (MRP)
[interp bug.zip](https://github.com/user-attachments/files/17236345/interp.bug.zip)
I include 2 examples in the MRP, simply comment and uncomment the lines as shown in the script.
Showcase:
Contributor guide
Assessment
This issue has not been assessed yet.