Jump to content

How to capture physics update for custom physics


liakos1992
 Share

Recommended Posts

By default, the desiredFps is 60, so the delta time (physicsElapsedMS) is 16.66 ms. Each 16.66 ms phaser update sprites based on velocity, gravity and other things with a function.

 

How to capture this physics update function or implement a callback there? I want to try to make a custom physics system :)

Link to comment
Share on other sites

Multiply your custom sprite's velocity in the update loop with :

* this.game.time.physicsElapsed

Example :

 NameSpace.Game.prototype.update = function () { this.myCustomSprite.position.x += this.customVelocityX * this.game.time.physicsElapsed; this.myCustomSprite.position.x -= this.customVelocityY * this.game.time.physicsElapsed; }
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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