Methods for rotating a set amount over a set time?
Posted: Tue Oct 04, 2011 9:41 am
So, when developing my little project with overly large ambitions I stumbled over a rather annoying problem. It's related to enemies going at certain angles and certain speeds, and changing the angle while they continue to go forward.
I want to make a function that, over a certain amount of seconds, rotates a given object, in my case an enemy (I am not working with love.physics) a given amount of degrees, no more, no less. My current approach that basically revolves around angle difference / time to be taken in seconds * dt is not working so well. That is, the test row of enemies starting at same angle and speed are rather spreading out post-rotation and that just isn't tidy. I'm actually calling love.timer.getDelta() in the rotation function separately, maybe that's my problem, but I'd assume the timer is the same during one calculation?!
I'm aware I could implement a completely fixed step to solve the problem, but as far as I understand that also opens up an entirely different can of worms. So my question is, is there a method of getting a fully fixed rotation over time that isn't the "fix rotation to a predeclared variable after rotating" hack I am currently using?
I want to make a function that, over a certain amount of seconds, rotates a given object, in my case an enemy (I am not working with love.physics) a given amount of degrees, no more, no less. My current approach that basically revolves around angle difference / time to be taken in seconds * dt is not working so well. That is, the test row of enemies starting at same angle and speed are rather spreading out post-rotation and that just isn't tidy. I'm actually calling love.timer.getDelta() in the rotation function separately, maybe that's my problem, but I'd assume the timer is the same during one calculation?!
I'm aware I could implement a completely fixed step to solve the problem, but as far as I understand that also opens up an entirely different can of worms. So my question is, is there a method of getting a fully fixed rotation over time that isn't the "fix rotation to a predeclared variable after rotating" hack I am currently using?