Godot Version
4.3
Question
I am creating desktop pet in Godot and I found strange glitch while it moves around.
So, when the pet moves fast (especially when dragged/dropped quickly), you can see a flickering or “extra frame” effect at the edges of the collisionBox 2D which wraps the pet. This happens only on some parts of screen and movement directions.
Pet is AnimatedSprite2D it is parent to Area2D which handles click events and is parent to CollisionBox2D which sets the non-passthrough that enables clicking and dragging.
Here is the passthrough funcion I use:
func update_passthrough():
if collision_shape and collision_shape.shape is RectangleShape2D:
**var shape\_size: Vector2 = collision\_shape.shape.size \* collision\_shape.scale**
**var top\_left = collision\_shape.global\_position - shape\_size / 2**
**var bottom\_right = collision\_shape.global\_position + shape\_size / 2**
**var passthrough\_area = PackedVector2Array(\[**
**top\_left, Vector2(bottom\_right.x, top\_left.y),**
**bottom\_right, Vector2(top\_left.x, bottom\_right.y)**
**\])**
**DisplayServer.window\_set\_mouse\_passthrough(passthrough\_area)**
I have tried changing rendering modes and pixel interpolation but none of them worked.
I’ll be very greatful for any tips!
Here is the video of the issue:
https://streamable.com/pioysq