Original date:2019-05-29 21:03:57 Edited by: euphoric Subject: Re: A Little Help

Icy_Viking said...

Thanks for the tips. I've removed the for loop outside of the while loops. The window now stays open. Yeah I thought the C example was bad. I don't think it really works besides showing the physics library version number.

It's likely that NewtonUpdate() needs to be called each frame, so determine how many frames you're getting, and use that to determine your timeStep.

integer frames = 0 
atom elapsedTime = time()+1 
while 1 do  
	key = get_key()  
	if key = 27 then  
	end if  
        -- if it's been a second since last calc, re-calc 
        if time() >= elapsedTime then 
            timeStep = elapsedTime / frames 
            frames = 0 
            elapsedTime = time()+1 
        end if 
end while  

In lots of game engines I've played with, the "timeStep" is referred to as the "delta time." You might want to look at that, or see if Newton has some docs on it. You have to use that to get consistent game speed across multiple processors.

Not Categorized, Please Help


Quick Links

User menu

Not signed in.

Misc Menu