Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tweening Transform2D borken when initial scale is not (1, 1) #79242

Closed
romlok opened this issue Jul 9, 2023 · 1 comment · Fixed by #79279
Closed

Tweening Transform2D borken when initial scale is not (1, 1) #79242

romlok opened this issue Jul 9, 2023 · 1 comment · Fixed by #79279

Comments

@romlok
Copy link
Contributor

romlok commented Jul 9, 2023

Godot version

v4.1.stable.official [9704596] < Steam

System information

Godot v4.1.stable - Debian GNU/Linux trixie/sid trixie - Vulkan (Mobile) - dedicated NVIDIA GeForce GTX 1060 (nvidia) - Intel(R) Core(TM) i5-8400 CPU @ 2.80GHz (6 Threads)

Issue description

When a tween is performed on a Transform2D, where the starting value has a scale which isn't (1, 1), both the position and scale of the intermediate values will be incorrect. However, the correct transform will be applied at the end of the tween:

simplescreenrecorder-2023-07-09_16.02.03.mp4

Steps to reproduce

Eg:

var tween := create_tween()
var start := Transform2D(Vector2.RIGHT, Vector2.DOWN, Vector2(100,100)) * 0.5
var end := Transform2D(Vector2.RIGHT, Vector2.DOWN, Vector2(200, 100))
(tween.tween_property($Tweened, "transform", end, 2.0)
	.from(start)
	)

Minimal reproduction project

Single self-contained scene. Click to start the tween:

tween_transform2d.zip

@romlok
Copy link
Contributor Author

romlok commented Jul 9, 2023

As a workaround, Transform2D.interpolate_with appears to work as expected, so one can apply the interpolation manually via tween_method instead. Eg:

tween.tween_method(
	func(weight): thing.transform = start_transform.interpolate_with(end_transform, weight),
	0.0, 1.0,
	duration,
	)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants