Physics.Arcade#accelerationFromRotation()

accelerationFromRotation(rotation, speed, point) → {Phaser.Point}

Given the rotation (in radians) and speed calculate the acceleration and return it as a Point object, or set it to the given point object.
One way to use this is: accelerationFromRotation(rotation, 200, sprite.acceleration) which will set the values directly to the sprites acceleration and not create a new Point object.

Parameters
Name Type Argument Default Description
rotation number

The angle in radians.

speed number <optional>
60

The speed it will move, in pixels per second sq.

point Phaser.Point | object <optional>

The Point object in which the x and y properties will be set to the calculated acceleration.

Returns
  • A Point where point.x contains the acceleration x value and point.y contains the acceleration y value.
Source code: physics/arcade/World.js (Line 1810)
doc_phaser
2017-02-14 10:58:51
Comments
Leave a Comment

Please login to continue.