iwand
ih, the image rotation as
angleradians, and the image scale X and Y as
sxand
syrespectively, what coordinates do I need to pass to
![cs2d lua cmd](img/i_codehelp.png)
EDIT: To make it clear.
edited 1×, last 29.05.17 03:34:52 pm
iwand
ih, the image rotation as
angleradians, and the image scale X and Y as
sxand
syrespectively, what coordinates do I need to pass to
(sy * ih) / 2
(sx * iw) / 2
function getSize(width, height, rot) 	rot = math.pi * rot / 180 	local NWL = width * math.cos(rot) 	local NHL = width * math.sin(rot) 	local NHU = height * math.cos(rot) 	local NWR = height * math.sin(rot) 	return math.floor(NWL + NWR), math.floor(NHU + NHL) end print(getSize(200, 80, 30))
function pos_trigger(x, y, rot, power) rot = (rot < -90) and rot + 360 or rot local angle = math.rad(math.abs(rot + 90)) - math.pi local new_x = math.floor((x + math.cos(angle) * power)) local new_y = math.floor((y + math.sin(angle) * power)) return new_x, new_y end