Stationeers

Stationeers

View Stats:
LittleShade Apr 3, 2023 @ 12:58pm
Why does sin 10 have a negative value in IC coding?
There is a problem converting the horizontal angle to the vertical angle because the value of the sine function is strange.

why? Does the sine function 10 have negative values?
< >
Showing 1-7 of 7 comments
HydrO Apr 3, 2023 @ 2:04pm 
its in radians

sin 10 = -0.54402111088

you can convert degress to radians by multipliying by 0,0174533 (π / 180)

sin(10* (π / 180)) =0.17364817766
Last edited by HydrO; Apr 3, 2023 @ 2:20pm
JeanDeaux Apr 3, 2023 @ 2:16pm 
Originally posted by HydrO:
its in radians

sin 10 = -0.54402111088

you can convert degress to radians by multipliying by 180 / π

sin(10* (180 / π)) =0.92759845634

Formula is correct, wording is backwards. That formula converts Radians TO Degrees.
HydrO Apr 3, 2023 @ 2:24pm 
If he was expecting to obtain positive values then he was working with degrees, he would need to convert from degrees to radians so the wording is correct, but you are right the formula was the other way around, its fixed now, thanks
LittleShade Apr 3, 2023 @ 9:12pm 
Thank you for everyone's help.
I forgot because it was old.

define PIE 3.1415926535897932384626433832795
start:
yield
div r0 PIE 180 #degree to radian
mul r0 r0 260
sin r0 r0
mul r0 r0 90 #horizontal to Vertical
slez r1 r0
select r1 r1 -1 1
mul r0 r0 r1 #negative to positive
j start
Last edited by LittleShade; Apr 3, 2023 @ 9:28pm
LittleShade Apr 26, 2023 @ 1:16pm 
Thank you HydrO, JeanDeaux, Jan Mars
The result came out with your help.

https://steamcommunity.com/sharedfiles/filedetails/?id=2966975779
Last edited by LittleShade; Apr 26, 2023 @ 1:47pm
Rocket  [developer] Apr 27, 2023 @ 1:28am 
Note in the latest update, we added constants for rad2deg and deg2rad to help with conversiuon instruction creation.
LittleShade Apr 27, 2023 @ 7:29am 
That's good news.
Thank you.
I don't think I can apply it right away because the server I play games on hasn't been updated yet.
< >
Showing 1-7 of 7 comments
Per page: 1530 50

Date Posted: Apr 3, 2023 @ 12:58pm
Posts: 7