godot
godot copied to clipboard
Textures and Sprites doesn't scale the position right when "rect_size" is added in AnimationPlayer
Godot version
3.5.1
System information
Windows (GLES 2.0)
Issue description
When you're adding a texture or sprite without any animation players, everything seems fine but when you intend to animate them especially animating their sizes, the position of the texture / sprite gets a little carried away and not correct
for example: if the texture is in the middle, it gets more to the left or right or even to the top
Steps to reproduce
N/A
Minimal reproduction project
Minimal reproduction project
Checked it out, not fully sure what's the issue. But I think you might be talking about the result of gui/common/snap_controls_to_pixels project setting being on (it's on by default). Try disabling it.
Also no need to animate anchors and position+size at the same time. Animating just the anchors should be enough (they affect both the position and the size).
Nope, still doesn't work
@kleonc what should we do then?
@MecoCL I'd say the main issue in the MRP is the animation itself. You need to be aware that for Control node both
(position + size) and (anchors + margins) define the same thing.
- When you're setting position/size then (anchors + margins) needs to be updated appropriately. By default anchors are unchanged and margins are recalculated.
- When you're setting anchors either margins or (position+ size) needs to be updated appropriately. By default margins are unchanged and (position+ size) is recalculated.
- When you're setting margins either anchors or (position+ size) needs to be updated appropriately. By default anchors are unchanged and (position+ size) is recalculated.
In your animation at each iteration:
- You change position, thus margins are changed.
- You change size, thus margins are changed.
- You change anchors (each of them), thus (position + size) are changed. This preserves just changed margins! If these margins are different than what they were at the moment you keyed the anchors within the animation then the resulting rect will be visually different than what you saw when creating the animation.
What to do? Fix your animation. Not sure what exactly you're going for but I suggest you to animate either (position + size) or (anchors + margins). Don't mix these and you should be fine.
I don't see an in-engine bug in here, AFAICT animation is working according to what you told it to do.
I'm sorry to re-open this but still, i tried to solve the problem and it didn't work even with animating the "position only"