Phaser: Feature suggestion : arcade physics engine `body.setMaxSpeed(speed)`

Created on 1 Sep 2018  路  4Comments  路  Source: photonstorm/phaser

Currently arcade physics engine has body.setMaxVelocity(x, y) to limit velocity in x and y part separated.
For example, body.setMaxVelocity(200)

  • If acceleration is (200, 0) every tick, the velocity will be (200, 0) -> max speed is 200.
  • If acceleration is (200, 200) every tick, the velocity will be (200, 200) -> max speed is 282.8427....

How about adding body.setMaxSpeed(speed) to limit the speed (vector length of velocity) in a steady value?


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

馃挅 Feature Request

Most helpful comment

Yeah, worth adding at some point I think.

All 4 comments

Yeah, worth adding at some point I think.

Set MaxVelocity will also limit the final angle of moving direction when speed-up continuously.
For example, asteroids movement, moving direction of ship will become 45/135/225/315 degrees (maxVelocity is (200,200) here) if initial angle of ship is not 0.

Is someone working on this feature? If not, I'd like to try to do this.

Thanks for opening this issue, and for submitting a PR to add it @Edwin222 . We have merged your PR into the master branch and attributed the work to you in the Change Log. If you need to tweak the code for whatever reason please submit a new PR.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JoeBerkley picture JoeBerkley  路  3Comments

SKEPDIMI picture SKEPDIMI  路  4Comments

lc-thomas picture lc-thomas  路  4Comments

samme picture samme  路  3Comments

sercand picture sercand  路  3Comments