0 votes

Hello! I have a very simple yet disturbing problem. I preloaded a scene (which has a node2D > rigidbody2D > sprite and collisionShape2D), and right before adding it as a child to another scene, I use setscale() to scale the RigidBody2D's sprite and collisionShape2D. However, the mouseenter and mouse_exit signals' triggering area did not scale as well,
i.e. those signals only trigger on the area of the scaled sprite that corresponds to it's area before scaling.

So I tried scaling the node2D, the Rigid Body2D, everything possible using the setscale() and scale() functions, tried overriding their _getitem_rect() functions and even updating them with update() method. Nope. None of that worked.

I would be really glad if someone could enlighten me here.
P.S: The RigidBody2D, Sprite, CollisionShape are all squares of same size and position.

in Engine by (12 points)

Scaling collision shapes will give you problems (is mentioned a couple of times on the docs).

Look for another way, you can try scaling the visual representation (sprite) and resize the shape to fit on it while keeping the body node intact.

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.