Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- float fps = 60;
- float targetDelta=1/fps; //this is the target time between each update//
- float offset=0; //offset tracks how far away this gets from the target//
- public void update(float delta){
- indexer++; //I assume the frame is timed correctly//
- offset+=(delta-targetDelta); //store the difference//
- while(offset<-targetDelta){ //and compensate//
- offset+=targetDelta;
- indexer--;
- }
- while(offset>targetDelta){
- offset-=targetDelta;
- indexer++;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement