Skip to content

Commit 59f7c53

Browse files
committed
P2.Body.addCapsule didn't use to pass the radius value through pxm, but now does so you have to specify it in pixels, not meters.
1 parent 73e9a74 commit 59f7c53

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ Version 2.1.0 - "Cairhien" - -in development-
188188
* Rectangle.bottom setter swapped the order of the calculation (thanks @JakeCoxon #1165)
189189
* Phaser.Text wouldn't render the text to its local canvas if you passed the text on the constructor and didn't add it to the display list. If a string is given it now updates the local canvas on creation.
190190
* Signal.removeAll would ignore the context parameter and remove all bindings regardless (thanks @alect #1168)
191+
* P2.Body.addCapsule didn't use to pass the radius value through pxm, but now does so you have to specify it in pixels, not meters.
191192

192193
### p2.js 0.6.0 Changes and New Features
193194

src/physics/p2/Body.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -918,15 +918,15 @@ Phaser.Physics.P2.Body.prototype = {
918918
*
919919
* @method Phaser.Physics.P2.Body#addCapsule
920920
* @param {number} length - The distance between the end points in pixels.
921-
* @param {number} radius - Radius of the capsule in radians.
921+
* @param {number} radius - Radius of the capsule in pixels.
922922
* @param {number} [offsetX=0] - Local horizontal offset of the shape relative to the body center of mass.
923923
* @param {number} [offsetY=0] - Local vertical offset of the shape relative to the body center of mass.
924924
* @param {number} [rotation=0] - Local rotation of the shape relative to the body center of mass, specified in radians.
925925
* @return {p2.Capsule} The Capsule shape that was added to the Body.
926926
*/
927927
addCapsule: function (length, radius, offsetX, offsetY, rotation) {
928928

929-
var shape = new p2.Capsule(this.world.pxm(length), radius);
929+
var shape = new p2.Capsule(this.world.pxm(length), this.world.pxm(radius));
930930

931931
return this.addShape(shape, offsetX, offsetY, rotation);
932932

0 commit comments

Comments
 (0)