I'm currently simulating the earth's rotation on its axis in my project. I calculated that one complete rotation of the earth equals
(2*Math.PI)
radians, so to determine the earth's rotation per minute (per frame), I used the formula:
(2*Math.PI)/(24*60)
. My program is rendering at 60FPS with requestAnimationFrame(), indicating that each second of runtime should simulate one hour of actual earth rotation. When I checked Chrome's JavaScript console, it was confirmed to be running at 60FPS. However, the simulation appeared to be twice as fast, completing a full rotation every 12 seconds instead of 24. By adjusting the expression to
(2*Math.PI)/(24*60*2)
, the rotation speed corrected itself, with 24 seconds now equaling one full rotation. While I'm relieved that the program is functioning properly, it's perplexing why multiplying the expression by a factor of (1/2) was necessary for this result. Any insights into this behavior would be appreciated. Thank you.
The render function within my code includes the following expression:
earth.rotation.y += (2*Math.PI)/(24*60*2)
.