So... I was trying to get an entity to do a very slow rotation (one full rotation per hour of gameplay).
My first attempt was a little "stuttery". The leaps in rotations are very small, but still noticeable.
while(1)
{
Planet.pan+=0.1;
wait(-1)
}
My second attempt sort of worked, with a couple drawbacks:
-I had to limit the framerate (or else values would be too small to count for an angle)
-Sometimes got some random crashes
fps_max=30;
while(1)
{
Planet.pan+=0.1*time_step/16;
wait(1);
}
After several failed attempts based around the second method, I reverted to trying a modified version of the first one...
while(1)
{
Planet.pan+=0.001;
wait(-0.01)
}
This last method gives smoother rotations than the first, but for some reason it feels like a "sloppy" workaround to me. I have the feeling it would be better with some formula utilizing time_step (like in my second attampt).
My questions for you experts out there are...
-Why would I get random crashes? Could it be related to some wierd (framerate-spikes related) values messing up the division? Could it be related to large pan values? Is a "planet.pan%=360;" instruction recommended here?
-Are all three methods actually exactly "1rph" (one full rotation per hour of gameplay)?
-Even if it is 1rph (or not)... Is there a better way of achieving it?