Skip to content

Commit e25eccb

Browse files
Guantol-LematConnorForan
authored andcommitted
Document Isaac.RenderToWorld
1 parent 9c05409 commit e25eccb

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

docs/docs/Isaac.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,30 @@ ___
8787
#### void DestroyWeapon ( [Weapon](Weapon.md) Weapon ) {: .copyable aria-label='Functions' }
8888
Destroys the provided [Weapon](Weapon.md) object.
8989

90+
___
91+
### RenderToWorld () {: aria-label='Functions' }
92+
#### [Vector](Vector.md) RenderToWorld ( [Vector](Vector.md) Pos ) {: .copyable aria-label='Functions' }
93+
Transfers Render coordinates into World coordinates.
94+
95+
Unlike [Isaac.ScreenToWorld](https://wofsauge.github.io/IsaacDocs/rep/Isaac.html#screentoworld) (which transfers Window coordinates into World coordinates), this is the true inverse of [Isaac.WorldToScreen](https://wofsauge.github.io/IsaacDocs/rep/Isaac.html#worldtoscreen) (which transfers World coordinates into Render coordinates).
96+
97+
???- info "Screen coordinate systems"
98+
The game uses 2 distinct coordinate systems when interacting with the Screen:
99+
100+
- "Window" coordinates: the actual pixel position within the game window (OS-level).
101+
- "Render" coordinates: an abstract coordinate system independent of window size or scaling.
102+
103+
Almost all functions that are used to interact with the screen use or return a position in **Render** coordinates.
104+
The only 2 exceptions are:
105+
106+
- `Isaac.ScreenToWorld`: which converts **Window** coordinates into World coordinates.
107+
- `Input.GetMousePosition(false)`: which returns the mouse position in **Window** coordinates.
108+
109+
???- info "Pixel snapping behavior"
110+
Alongside converting the World coordinates into Render coordinates, `Isaac.WorldToScreen` snaps the render coordinates to the closest pixel perfect position.
111+
This means that converting Render coordinates into World coordinates, then back into Render coordinates is not guaranteed to return the original result; unless
112+
it is in a pixel perfect position.
113+
90114
___
91115
### DrawLine () {: aria-label='Functions' }
92116
#### void DrawLine ( [Vector](Vector.md) StartPos, [Vector](Vector.md) EndPos, [KColor](https://wofsauge.github.io/IsaacDocs/rep/KColor) StartColor, [KColor](https://wofsauge.github.io/IsaacDocs/rep/KColor) EndColor, int Thickness ) {: .copyable aria-label='Functions' }

0 commit comments

Comments
 (0)