Hi
I am trying to calculate the tan of an angle.
I tried this
console.log(“TAN TEST 50=”+Math.tan(50));
I see this…
TAN TEST 50=-0.27190061199763077
I was expecting to see…
1.19
RESOLVED!!!
degrees must be in Radians. I didn’t realise this so…
// Angle in radians = Angle in degrees x PI / 180.
this.tanAngle = this.rotation * Math.PI / 180;
// move in the direction pointed…
this.x += Math.tan(this.tanAngle)*2;
Thank you
Greg