[DiscordArchive] any idea how I can calculate SetTexCoord properly?
[DiscordArchive] any idea how I can calculate SetTexCoord properly?
Archived author: Matth • Posted: 2022-04-25T15:34:29.311000+00:00
Original source
any idea how I can calculate SetTexCoord properly?
Archived author: Foe • Posted: 2022-04-25T16:39:56.963000+00:00
Original source
I have a script for it
Archived author: Foe • Posted: 2022-04-25T16:40:47.865000+00:00
Original source
I just don't remember who I sent it to
Archived author: Foe • Posted: 2022-04-25T16:43:55.898000+00:00
Original source
```function CoordsToTexCoords(size, xTop, yTop, xBottom, yBottom)
local magic = (1/size)/2
local Top = (yTop/size) + magic
local Left = (xTop/size) + magic
local Bottom = (yBottom/size) - magic
local Right = (xBottom/size) - magic
return Top, Left, Bottom, Right
end
local Top, Left, Bottom, Right = CoordsToTexCoords(128, 80, 35, 113, 68)
print(Top, Left, Bottom, Right) ```
Archived author: Honey • Posted: 2022-04-25T17:50:24.782000+00:00
Original source
Now i wonder where we get that `size` value from
Archived author: Foe • Posted: 2022-04-25T17:53:27.347000+00:00
Original source
Size of the texture part
Archived author: Foe • Posted: 2022-04-25T17:53:42.109000+00:00
Original source
128x128 section as an example
Archived author: Foe • Posted: 2022-04-25T17:53:46.641000+00:00
Original source
Size would then be 128