I’m using CollisionShape2D.shape.get_rect().size.x to get the width, but it’s returning 101, which doesn’t match the actual width of the shape. Any idea why this is happening?
Does MobArea1 or it’s CollisionShape2D have an x scale other than 1.0?
If you select the CollisionShape2D you can click into the RectangleShape2D resource and confirm the size of the shape. This value should representative of what get_rect().size is returning, and this value shouldn’t change if the scale is being changed to make it larger.
So I am guessing your collision shape is 101 wide at the moment. Are you using any camera zooms perhaps? Or a strange shape like a polygon or circle? Try in the debug settings setting collision shapes visible and see what it looks like in your game. That might help identify your problem.
PS Are you sure you are referencing the correct shape?
PPS @withersail raised a good point. Parent node scaling might be an issue too.