gxmikvid
(gxmikvid)
February 24, 2020, 9:05pm
1
So what i am trying to achieve is this.
Simplified.
What i got is a check if values are exact and if not where are they, how close they are to the exact values, ect… and roblox’ orientation coordinates are weird (might be convertable to 0 360 from the -180 180).
Is there a better, easier way of doing this, or is it just a case of “handle every situation” basically?
I just need a method to doing this, i don’t need a complete script.
1 Like
n00kii
(nookii)
February 24, 2020, 9:47pm
3
if you have the angle, just do math.sin(math.rad(x)) assuming x is the angle in degrees.
3 Likes
gxmikvid
(gxmikvid)
February 24, 2020, 9:54pm
4
Thank you.
I can work from here.
1 Like
gxmikvid
(gxmikvid)
February 24, 2020, 10:00pm
5
Can i ask for something?
Can you convert from roblox’ orientation (with minus degrees) to a 0-360 type orientation coordinates
n00kii
(nookii)
February 24, 2020, 10:05pm
6
maybe do
function normalizeAngle(angleDegrees)
if angleDegrees >= 0 then
return angleDegrees
else
return 360 - (-1 * angleDegrees)
end
end
1 Like
gxmikvid
(gxmikvid)
February 24, 2020, 10:05pm
7
Also i get weird values like
when close to being -1
n00kii
(nookii)
February 24, 2020, 10:06pm
8
it probably has something to do with floating point inaccuracies
try math.floor(math.sin(math.rad(x))) instead
1 Like
gxmikvid
(gxmikvid)
February 24, 2020, 10:09pm
9
Can i do a thing where i only calculate to only 2 decimal places? And not to the nearest whole?
(sorry not native english speaker)
Edit: nvm i can look for it
thx for helping
n00kii
(nookii)
February 24, 2020, 10:20pm
10
np
psssst… math.floor(math.sin(math.rad(angleDegreesNormalized))/0.01 + 0.5) * 0.01)
1 Like