Jump to content

fixed physics update


matwho
 Share

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 ?
});

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...