I'm trying to do some manipulation of mouse click coordinates which requires using the extents of a
CollisionShape2D with shape
RectangleShape2D. Here are the relevant details
Rect position (0,0)
Rect size x=860 y=733
Rect scale x=0.75 y=0.75
Transform position (430,365)
Transform Scale x=1 y=1
Absolute position (322.5,273.75)
Transform position (0,0)
Transform scale x=1 y=1
Shape extents x=327 y=327
I've manually resized the
CollisionShape2D so that it covers precisely the subarea of the root
TextureRect upon which I wish to capture clicks. This yields the given extent values.
My original interpretation of the way Extents work told me that the absolute x-coordinates of the edges of the
CollisionShape2D should be
322.5 - 327 = -4.5
322.5 + 327 = 649
But now I know that isn't how it works since it is plain from the viewport's ruler that the true values are approximately 77.5 and 567.5.
So I think there is something I'm not understanding about how extents work but the only description I've been able to find online is that they are the shape's half width and half length.
If I change the scale on the root node to x=1 and y=1, say, I notice that the extent values remain fixed despite the
RectangleShape2D being scaled up in size. So the lengths referred to by the extents must be with respect to some other (hidden) ruler than the one provided by the viewport, which makes it difficult for me to understand and work with the values.
Can anyone help me understand what that hidden ruler is, and how to work with the extent values?