Sign in to follow this  
matwho

fixed physics update

Recommended Posts

Hi all, 

I am a bit confused on how should I procede if I want to have my game update the physics at 25hz.

So, clearifying myself, my scenario:

I have a game server that run updates 25 time per sec.

I need on my client ( Just trying out pixi ) to simulate the physics too because of lag ( dead reckoning, ecc. ecc. )

So, i tried out this, but that bunny looks so clumsy. ( it is the basic example )

What's the good way to get it done ?

var update_rate = 1000 / 25;
var update_time = 0;


// Listen for animate update
app.ticker.add(function(delta) {
    update_time += app.ticker.elapsedMS;
  
    if (update_time < update_rate)
      return;
    update_time -= update_rate;
  
    bunny.rotation += 0.1 * delta; // is that even corret to multiply with delta in this case ?
});

 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.