Skip to content

Rename Vector2#setToPolar() arguments #7128

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: v4.0.0
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/math/Vector2.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,22 +196,22 @@ var Vector2 = new Class({
},

/**
* Sets the `x` and `y` values of this object from a given polar coordinate.
* Sets the x and y components of this Vector from the given angle and length.
*
* @method Phaser.Math.Vector2#setToPolar
* @since 3.0.0
*
* @param {number} azimuth - The angular coordinate, in radians.
* @param {number} [radius=1] - The radial coordinate (length).
* @param {number} angle - The angle from the positive x-axis, in radians.
* @param {number} [length=1] - The distance from the origin.
*
* @return {Phaser.Math.Vector2} This Vector2.
*/
setToPolar: function (azimuth, radius)
setToPolar: function (angle, length)
{
if (radius == null) { radius = 1; }
if (length == null) { length = 1; }

this.x = Math.cos(azimuth) * radius;
this.y = Math.sin(azimuth) * radius;
this.x = Math.cos(angle) * length;
this.y = Math.sin(angle) * length;

return this;
},
Expand Down