I want to rotate a line to an angle specified I have no idea how id go about this.
Quote from: atheek on May 21, 2024, 12:14 PMI want to rotate a line to an angle specified I have no idea how id go about this.
There is a way to do so using Degrees via the Sine and Cosine functions.
local degree = 180 --the degree you want
local magnitude = 5 --how big it is (also goes negative)
local calcx, calcy = math.sin(degree) * magnitude, math.cos(degree) * magnitude
Same but with a function:
function getrotationvalue(deg, mag)
local degree = deg
local magnitude = mag
local calcx, calcy = math.sin(degree) * magnitude, math.cos(degree) * magnitude
return calcx, calcy
end
Hope this helps understading this issue you're having!