Originally Posted by zork
Hmmm. When working with textures that use an aspect of 1 (square), is the following condensed Transform function correct?
Lua Code:
local mcos, msin = math.cos, math.sin local function Transform(texture, angle) local c,s = mcos(angle), msin(angle) local ULx, ULy = 0.5-c+s, 0.5-c-s local LLx, LLy = 0.5-c, 0.5-s local URx, URy = 0.5+s, 0.5-c local LRx, LRy = 0.5, 0.5 texture:SetTexCoord(ULx, ULy, LLx, LLy, URx, URy, LRx, LRy) end
|
Yeah, if you're only manipulating square textures it looks like that does the same thing as calling
Transform(-0.5, -0.5, angle, 1) with the function I wrote.
If you'd rather work with degrees instead of radians, I believe the blizzard functions
sin and
cos are degree-based instead of the radian-based
math.sin and
math.cos, so you don't even have to convert between them if you use those instead.