godotengine / godotengine/godot-docs

Specify the units used in AtlasTexture's region

Open
#8,530 0 comments 0 reactions 0 assignees View on GitHub
area:class reference enhancement
Dominant language
reStructuredText
Stars
5.7k
Forks
3.8k
Avg merge
1d 20h
Merged PRs (30d)
25

Description

**Your Godot version:** 4.1

**Issue description:**
The description for an AtlasTexture's region is vague.
```
The region used to draw the atlas.
```
The description of the AtlasTexture itself does not clarify this either.
```
Texture2D resource that draws only part of its atlas texture, as defined by the region.
An additional margin can also be set, which is useful for small adjustments.
```
This leads to confusion for those working on code involving texture atlassing.
- Is this in pixels like the editor shows? Texels?
- Is this in UV coordinates like meshes would use?

I think this could be resolved simply by adding some detail to what unit the region uses, and the upper and lower limits of its size. (eg: The region size is based on its floating point UV coordinates, which range from (0,0) to (1,1))

EDIT: I've since gone and tested this myself in the editor, perhaps something like this would be sufficient.
```
The region used to draw the atlas in pixel coordinates.
Positions are relative to the texture at its original scale.
A pixel coordinate at (0, 0) maps to the top-left corner of the texture.
```

**URL to the documentation page (if already existing):**
https://docs.godotengine.org/en/stable/classes/class_atlastexture.html#class-atlastexture-property-region

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.