Skip to content

Commit 6830362

Browse files
committed
Setting an existing Game Object as a static Arcade Physics body would sometimes incorrectly pick-up the dimensions of the object, such as with TileSprites. Fix phaserjs#3690
1 parent 6eea9db commit 6830362

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
* Camera.cull will now accurately return only the Game Objects in the camera's view, instead of them all. Fix #3646 (thanks @KingCosmic @Yora)
4141
* The `dragend` event would be broadcast even if the drag distance or drag time thresholds were not met. Fix #3686 (thanks @RollinSafary)
4242
* Restarting a Tween immediately after creating it, without it having first started, would cause it to get stuck permanently in the Tween Managers add queue (thanks @Antriel @zacharysarette)
43+
* Setting an existing Game Object as a static Arcade Physics body would sometimes incorrectly pick-up the dimensions of the object, such as with TileSprites. Fix #3690 (thanks @fariazz)
4344

4445
Changes the checks for Camera.cull to give only the game objects in the camera's view instead of all game objects
4546

src/physics/arcade/StaticBody.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ var StaticBody = new Class({
2828

2929
function StaticBody (world, gameObject)
3030
{
31+
var width = (gameObject.width) ? gameObject.width : 64;
32+
var height = (gameObject.height) ? gameObject.height : 64;
33+
3134
/**
3235
* [description]
3336
*
@@ -119,7 +122,7 @@ var StaticBody = new Class({
119122
* @type {number}
120123
* @since 3.0.0
121124
*/
122-
this.width = gameObject.displayWidth;
125+
this.width = width;
123126

124127
/**
125128
* [description]
@@ -128,7 +131,7 @@ var StaticBody = new Class({
128131
* @type {number}
129132
* @since 3.0.0
130133
*/
131-
this.height = gameObject.displayHeight;
134+
this.height = height;
132135

133136
/**
134137
* [description]

0 commit comments

Comments
 (0)