godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
89.17k stars 20.21k forks source link

Scalling Issue 2D #58480

Open DogsCodesStudio opened 2 years ago

DogsCodesStudio commented 2 years ago

Godot version

4.0 Alpha 3

System information

Window 10

Issue description

When making a StaticBody2D having CollisionShape2D and Sprite 2D as a child with CollisionShape2D being a Rectangle Shape as the shape, and Canvas Texture as the Texture for the Sprite2D. The size of the Sprite 2d is 21x smaller then the collision. I would expect at both scale of 1 them to be the same size.

Steps to reproduce

Create a StaticBody2D having CollisionShape2D and Sprite 2D as a child with CollisionShape2D being a Rectangle Shape as the shape, and Canvas Texture as the Texture for the Sprite2D.

Minimal reproduction project

RPG(Client) - Copy.zip

IgorKordiukiewicz commented 2 years ago

It's because a new empty CanvasTexture is initialized as a 1x1 texture, whereas CollisionShape2D with rectangle shape is initialized with 20x20 size. But I think it is not an issue because you should probably just modify the CollisionShape size using its size property and not scale property.

saierXP commented 1 year ago

I think this is a feature request not a bug report.The size of CanvasTexture depends on diffuse_texture, When it's empty, the default texture is a 1x1 white square.

Calinou commented 1 year ago

It's recommended to load an image directly using the Quick Load or Load option instead of using CanvasTexture if you don't intend to use normal/specular maps.

The current behavior could be documented better (including when CanvasTexture is relevant to use), but I believe it's intended.