Hello Flash coders, It's been a little quite here of late… So, hope it's good with with you all. … I have been trying to figure this out for a day or so, and wondering if you can help. I am trying to time correct my animation to be independent of framerate, which is a little easier when dealing with physics (scaling velocity / position) than non physics animation… In my app physics is time corrected, however I have some code that is not physics based an am trying to have that running independently of framerate (and not really succeding).
In the following demo: http://kurst.co.uk/transfer/timecorrection/TimeCorrection.swf I have two rects ( green and red ). The green one is being time corrected, and I would expect it to follow the red one ( as there is no lag in framerate )… however as you can see - it's not really working. Using the following formula to correct it: var spcTargetPosition : Point = new Point() spcTargetPosition.x = ( spc.x + ( spc.x + 10 ) ) * speed * spcDir; spcTargetPosition.y = spc.y; dt = 0.001 * (getTimer() - t0); time += dt; t0 = getTimer(); spc.x = spc.x + ( dt * spcTargetPosition.x ); Here is the full code: http://kurst.co.uk/transfer/timecorrection/TimeCorrection.as I would love it if you can point out where I am going wrong... Best regards Karim Beyrouti t: +44 (0) 7977 997 629 e: ka...@kurst.co.uk w: http://kurst.co.uk skype: karimbeyrouti 109 Timber Yard, Drysdale Street, Hoxton, London, N1 6ND Karim Beyrouti t: +44 (0) 7977 997 629 e: ka...@kurst.co.uk w: http://kurst.co.uk skype: karimbeyrouti 109 Timber Yard, Drysdale Street, Hoxton, London, N1 6ND _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders