Commit graph

681 commits

Author SHA1 Message Date
Richard Davey
d46662cd46 Swapped to using Number.MAX_VALUE so repeat -1 now works properly in IE11 and below. 2018-01-18 14:59:32 +00:00
Richard Davey
2deb9edc9e Plugins now check to see if the Scene is already booted and adapt accordingly. 2018-01-18 14:00:31 +00:00
Richard Davey
5a333bc2fd Updated to new Plugin format, removed injection and mapping 2018-01-18 05:18:09 +00:00
Michael Hadley
fd8cad1fb6 Add Impact method for loading collision map from Weltmeister file 2018-01-17 18:50:00 -06:00
Michael Hadley
5bc09a2c5c Update AP physics to handle tiles where tileSize !== baseTileSize 2018-01-17 11:27:29 -06:00
Richard Davey
108b6bd2a3 Events call the world directly, avoids an unnecessary function jump. 2018-01-17 15:28:53 +00:00
Richard Davey
f41d016c9f Moved Matter over to use the plugin system. 2018-01-17 15:22:16 +00:00
Richard Davey
b17744df61 Merge branch 'master' of https://github.com/photonstorm/phaser 2018-01-17 03:42:03 +00:00
Richard Davey
ddba95873d Moved Arcade and Impact Physics over to the new plugin system 2018-01-17 03:41:58 +00:00
Michael Hadley
814e5af815 Remove recalculation of tile bounds from arcade physics 2018-01-16 19:03:13 -06:00
Richard Davey
ca7550aa6f Moved plugins 2018-01-16 18:38:29 +00:00
Michael Hadley
bf413ea604 Implemented tile & layer callbacks in arcade physics 2018-01-12 15:00:37 -06:00
Michael Hadley
ef58640026 Arcade: tilemap collisions/overlaps now emit appropriate events 2018-01-12 14:23:36 -06:00
Michael Hadley
8f0b428209 Bug fix in events: overlap used where collide should be 2018-01-12 14:20:48 -06:00
Richard Davey
f00f467eec Matter now using new EventEmitter. 2018-01-12 18:59:11 +00:00
Richard Davey
f9a1e27334 Removed un-used event files and references. 2018-01-12 17:20:16 +00:00
Richard Davey
c625b8735b Updated to using Event Emitter for all key managers and game objects. Events are now dispatched directly using arguments instead of Event objects, all managers updated to emit directly. 2018-01-12 17:09:21 +00:00
Michael Hadley
15825eacb3 Add note about circle bodies not currently being supported in Arcade tile intersection 2018-01-12 10:53:36 -06:00
Michael Hadley
bab399a02e Made CollideHandler consistent by returning value from logic branches
Each branch should return true/false based on whether a collision happened
2018-01-11 14:13:42 -06:00
Michael Hadley
00cebf8eae CollideGroupVsTilemapLayer implementation 2018-01-11 14:03:34 -06:00
Michael Hadley
5241798ab3 Pass TILE_BIAS from arcade world into tile colliding functions 2018-01-11 08:32:07 -06:00
Michael Hadley
98ae8009e0 Arcade rect vs tilemap layer collision handling 2018-01-10 20:47:25 -06:00
Michael Hadley
32788d6eb6 Stub arcade collide vs tilemap methods 2018-01-10 20:43:11 -06:00
Michael Hadley
e3699aaea0 Remove unnecessary Arcade Body#tilePadding 2018-01-10 19:34:22 -06:00
Richard Davey
d8f1ba03e9 Moved repository location 2018-01-09 21:43:56 +00:00
Richard Davey
0d90f75b5f Splitting the dev branch up into versions. 2016-11-22 01:36:56 +00:00
Richard Davey
4d4344bf03 Arcade Physics updated to use new Transform system. 2016-11-11 02:20:31 +00:00
photonstorm
26711241ac Disabled access to World and Camera for now. 2016-10-14 02:20:35 +01:00
Richard Davey
380e717e52 Finished off missing factories. Moved over the docs. Changed rogue @returns to @return everywhere. 2016-10-08 16:17:46 +01:00
Richard Davey
31592b98f1 The P2 Physics library has been updated to 0.7.1. This is still quite out of date, but as soon as they release their latest build (hopefully soon) we'll update to that. 2016-09-21 23:16:14 +01:00
Richard Davey
8a78029e2b Merge pull request #2728 from samme/issue-2720
Add a hint for resizing Body of scaled Sprites
2016-09-07 23:27:34 +01:00
James
42ca43d98c updated docs on Arcade body's setSize 2016-08-30 17:08:25 -05:00
samme
792ae127bf Add a hint for resizing Body of scaled Sprites 2016-08-29 12:50:05 -07:00
photonstorm
ad0e4aca2e Large batch of jshint fixes. 2016-08-25 13:03:41 +01:00
samme
b05becf962 Correct docs:
* `angularAcceleration`, `angularDrag`, and `angularVelocity` are measured in degrees.
* `angle` describes `velocity` and is unrelated to angular motion
2016-08-22 12:05:12 -07:00
photonstorm
11b0436a26 Fixed Arcade Physics Circle body collision, after the #2654 change broke it unintentionally. 2016-08-22 16:23:22 +01:00
photonstorm
7b9c4114b2 Preparing for 2.6.2 release. 2016-08-22 12:31:02 +01:00
Richard Davey
19342fa3af ArcadePhysics Body.rotation now reads its initial value from sprite.angle instead of sprite.rotation. The property was immediately replaced with the correct value in Body.preUpdate regardless, but it keeps it consistent (thanks @samme #2708) 2016-08-21 10:27:58 +01:00
Richard Davey
9654a4b3c5 Consolidating Layers into View class. 2016-07-25 01:39:46 +01:00
Richard Davey
6947057427 The property checkCollision.none in the ArcadePhysics.Body class was available, but never used internally. It is now used and checked by the separate method. By setting checkCollision.none = true you can disable all collision and overlap checks on a Body, but still retain its motion updates (thanks @samme #2661) 2016-07-23 10:01:38 +01:00
Richard Davey
46c20ab00a The property checkCollision.none has been removed from the ArcadePhysics.Body class. It was never used internally, so lead to confusion about its use. To disable a body, use body.enable = false (thanks @samme #2661) 2016-07-23 09:43:01 +01:00
photonstorm
3ba00bbf2d Loads of work on tilemap collision, and offset support. You can now collide with a tilemap no matter where it is on the screen, or which layer it's from. 2016-07-22 17:02:10 +01:00
photonstorm
0e25c5acac Revert getTiles call. 2016-07-22 14:08:54 +01:00
Richard Davey
d8560eb3bc Fixed Tilemap collision. 2016-07-22 04:32:56 +01:00
Leopoldo Brines
18472f5998 Fix 'TypeError: target.center is undefined' 2016-07-20 18:34:02 -04:00
Boniatillo.com
3d1b10c310 jsdoc fix: replace #onTop for #onCeiling
Modified the jsdoc of Phaser.Arcade.Body.onCeiling, by replacing the #onTop reference for #onCeiling.
2016-07-19 08:32:34 -04:00
photonstorm
ac2516f5aa 2.6.1 Release. 2016-07-11 10:07:56 +01:00
Richard Davey
cfb2b813ef Fixed Uncaught TypeError: Cannot set property 'x' of undefined in Body.js (thanks @ErwanErwan #2607) 2016-07-08 18:54:00 +01:00
photonstorm
61ce14f332 P2.World.clear will now clear out the World.walls property, resetting all of the wall bounds to null. This allows the walls to be re-created accurately when the P2 World is reset, which happens on a State change or restart (thanks @ewpolly1 @codermua #2574) 2016-07-08 13:02:58 +01:00
photonstorm
dfd9203e0a onWorldBounds now sends the bounds it collided with. 2016-07-08 11:28:45 +01:00
Richard Davey
c0ba439e82 ArcadePhysics.Body.onCollide is a new Signal that is dispatched whenever the Body collides with another Body. Due to the potentially high volume of signals this could create it is disabled by default. To use this feature set this property to a Phaser.Signal: sprite.body.onCollide = new Phaser.Signal() and it will be called when a collision happens, passing two arguments: the sprites which collided.
ArcadePhysics.Body.onOverlap is a new Signal that is dispatched whenever the Body overlaps with another Body. Due to the potentially high volume of signals this could create it is disabled by default. To use this feature set this property to a Phaser.Signal: `sprite.body.onOverlap = new Phaser.Signal()` and it will be called when an overlap happens, passing two arguments: the sprites which collided.
2016-07-07 23:16:18 +01:00
Richard Davey
6ba3c9401f ArcadePhysics.Body.setCircle is a new method that allows you to define an Arcade Physics Body as being a circle instead of a rectangle. You can control the radius of the body and the offset from the parent sprite.
ArcadePhysics.World.separateCircle is a new method that handles all circular body collisions internally within Arcade Physics (thanks @VitaZheltyakov)

All of the Arcade Physics internal methods, such as `collideGroupVsSelf`, `collideSpriteVsSprite` and so on, have been updated to work with circular body shapes (thanks @VitaZheltyakov)

ArcadePhysics.Body.onWorldBounds is a new Signal that is dispatched whenever the Body collides with the world bounds, something that was previously difficult to detect. Due to the potentially high volume of signals this could create it is disabled by default. To use this feature set this property to a Phaser.Signal: `sprite.body.onWorldBounds = new Phaser.Signal()` and it will be called when a collision happens, passing one argument: the sprite on which it occurred.
2016-07-07 21:58:39 +01:00
photonstorm
261155a683 Merged the arcade-circles branch back into 2.6 and tidied up lots of the source code. Needs checking as not working properly with rect vs. circle, but fine with circle vs. circle. 2016-07-07 16:45:10 +01:00
photonstorm
4da3b15ae2 Renamed alignTo to alignIn, and added the new method alignTo, to allow for Sprite to Sprite alignment. Updated all of the Bounds and TS defs. 2016-06-16 17:01:51 +01:00
Richard Davey
70be74cb36 Lots of work on Body.moveTo and Body.moveFrom. Now working nicely. 2016-06-15 04:12:47 +01:00
Richard Davey
b5cc01132c Body.move tests. 2016-06-14 23:45:00 +01:00
Richard Davey
1daf897b23 Small styling fixes. 2016-06-09 23:27:19 +01:00
Upperfoot
bab2fac729 Resolved issue with tilemapLayer collision. 2016-06-08 23:52:56 +01:00
Craig Whiteside
212a07b9ac Fixed problem with missing parameter in tileCheckX and tileCheckY. 2016-06-07 14:00:34 +01:00
Craig Whiteside
7a1667fa7e Fixed typo on collision for TileMapLayers (lesson to triple check your code...) 2016-06-06 15:43:51 +01:00
Richard Davey
05ca827c2b Merge pull request #2522 from Upperfoot/master
Fixing tileMap collision when tileMapLayer is set to a position other than 0,0
2016-06-03 12:45:37 +01:00
photonstorm
a81fe3cf02 jshint fixes. 2016-06-02 15:38:05 +01:00
Vitaliy
cd3742f9f2 Corrected intersects fuction
Added protection against incorrect handling collisions. Clashes with the body itself will not be processed.
2016-05-31 01:18:17 +03:00
photonstorm
c1c2e6bc9d Removed left-over Body.isCircle checks. 2016-05-23 23:02:04 +01:00
photonstorm
e974ff4ee9 Removed Circle functions and updated setSize docs. 2016-05-23 13:16:21 +01:00
photonstorm
16e9acac84 Updated Body.reset call. 2016-05-23 12:54:41 +01:00
photonstorm
09dd84565e Arcade Physics Body incorrectly positioned if the Sprite had a negative scale (see http://www.html5gamedevs.com/topic/22695-247-248-body-anchoring-any-migration-tips/) (thanks @SBCGames @icameron @Nuuf @EvolViper #2488 #2490) 2016-05-23 12:46:01 +01:00
Upperfoot
4a3e8f2b4a Take into consideration Tilemap position into collision 2016-05-19 11:06:49 +01:00
photonstorm
7018ca2132 Position in Body.reset #2470 2016-05-16 15:20:44 +01:00
photonstorm
ac89d1aec7 Arcade Physics Body has a new property worldBounce. This controls the elasticity of the Body specifically when colliding with the World bounds. By default this property is null, in which case Body.bounce is used instead. Set this property to a Phaser.Point object in order to enable a World bounds specific bounce value (thanks @VitaZheltyakov #2465) 2016-05-16 13:53:12 +01:00
photonstorm
f9994fac75 Fixed a bug in Arcade Physics Body.preUpdate which would incorrectly apply the position of an offset Body (one which has had Body.setSize used on it) when combined with a Sprite with a non-zero anchor (thanks @SBCGames #2470) 2016-05-16 13:39:46 +01:00
photonstorm
19dce62734 Arcade Physics has had a new world argument added to the following functions: distanceBetween, distanceToXY, distanceToPointer, angleBetween, angleToXY and angleToPointer. The argument (which is false by default), when enabled will calculate the angles or distances based on the Game Objects world property, instead of its x and y properties. This allows it to work for objects that are placed in offset Groups, or are children of other display objects (thanks @Skeptron for the thread #2463) 2016-05-16 13:31:57 +01:00
photonstorm
f494c867c7 Fixed an issue in the Arcade Physics overlap method where it would only detect overlaps up to the max bias threshold and no further (thanks @rgk #2441)
The Arcade Physics overlap method would return false if two bodies were overlapping but neither had any velocity (i.e. they were embedded into each other)
2016-04-25 11:38:51 +01:00
photonstorm
628dd1c420 P2.Body.offset is now used and applied to the Sprite position during rendering. The values given are normal pixel values, and offset the P2 Body from the center of the Sprite (thanks @Mourtz #2430) 2016-04-18 20:57:41 +01:00
photonstorm
41f81d39b7 jsdocs update (and removed isCircle switch) 2016-04-18 16:17:47 +01:00
photonstorm
ac4acfb912 Removed Arcade Physics Circle support (now in its own branch) ready for 2.4.7 release. 2016-04-14 13:23:28 +01:00
photonstorm
4d8753e9ce Tidying up for 2.4.7. 2016-04-14 12:57:05 +01:00
photonstorm
aad499b025 Tidying up the code base for 2.4.7. 2016-04-14 12:43:10 +01:00
photonstorm
f4277efc20 Alternative snooker-ball like collision test. 2016-04-11 16:43:17 +01:00
photonstorm
3c4e63fda5 World.separateCircle is working with circle vs. circle bodies. 2016-04-08 03:37:49 +01:00
photonstorm
d009b8d769 Circle vs. Circle rebound code started. 2016-04-07 19:32:27 +01:00
photonstorm
cc5361dd6d World.separate has been optimized to cut down on the number of calls to intersect from 3 calls per Game Object collision check, to 2. So if you were colliding 50 sprites it will reduce the call count from 150 to 100 per frame. It also reduces the calls made to seperateX and seperateY by the same factor.
Two immovable bodies would never set their overlap data, even if an overlap only check was being made. As this is useful data to have this has been changed. Two immovable bodies will still never separate from each other, but they _will_ have their `overlapX` and `overlapY` properties calculated now.
2016-04-07 18:04:45 +01:00
photonstorm
50e126f59e * Body has two new properties: left and top. These are the same as Body.x and Body.y but allow you to pass the Body to geometry level functions such as Circle.contains.
* Body.setCircle allows you to define a Body as using a circle to collide with instead of a rectangle. You can set the radius of the collision circle and an offset.
* Body.render now renders both circle and rectangle body shapes to the Debug canvas.
* World.intersects has been updated to support both circle and rectangle body shapes, and supports quick-paths for circle vs. circle and rect vs. rect checks.
* World.circleBodyIntersects is a new method that checks for intersection between a Body that has been defined as a circle, and a normal rectangle based Body. This is used internally by World.intersects, but exposed for direct calls as well.
2016-04-07 17:01:16 +01:00
photonstorm
952b5c04ea The start of Arcade Physics circle bodies. 2016-04-07 14:32:53 +01:00
photonstorm
e5ceb7e9bc P2.World.setBounds has been re-written completely. If the World is resized it no longer removes the P2 body instances and re-creates them. Instead it checks to see which walls are required and then just moves the position of the shapes instead, or updates them, or creates or destroys them as required. This is far more efficnent, especially in a game which see's a lot of world bounds changes (i.e. resizes responsively in browser) 2016-04-07 01:56:42 +01:00
photonstorm
5c261821fe P2.World.updateBoundsCollisionGroup didn't set the _boundsOwnGroup private var, meaning the World.setBounds method wasn't able to restore previously set collision masks automatically (thanks @jmp909 #2183) 2016-04-07 01:25:52 +01:00
photonstorm
4d5a037ae5 P2.World.updateBoundsCollisionGroup wouldn't use the boundsCollisionGroup mask if you passed true as the argument, only if it was left undefined. 2016-04-07 01:18:19 +01:00
Richard Davey
2f0231b3cd Merge pull request #2415 from jakewilson/dev
Fixed and added warnings.
2016-04-06 01:21:09 +01:00
photonstorm
6933b41e6f Arcade.Body's speed property was only set when the body moved, it now updates regardless (thanks @mark-henry #2417) 2016-04-05 23:06:57 +01:00
Jake Wilson
96a79cd91a Added warning if physics body is enabled on unknown physics system. 2016-04-05 11:23:17 -04:00
photonstorm
f40cfbe2ae 2015 - 2016. 2016-04-04 22:16:16 +01:00
Chad Engler
a510761bf1 fix typo in componentToHex 2016-03-09 15:54:40 -08:00
Richard Davey
0c48c2d6a8 * Added P2.Body.thrustLeft which will move the Body to the left by the speed given (thanks James Pryor)
* Added P2.Body.thrustRight which will move the Body to the right by the speed given (thanks James Pryor)
2016-03-01 22:31:58 +00:00
Richard Davey
5801f1aa15 jshint fixes. 2016-02-04 23:39:58 +00:00
photonstorm
a7c360425f Tidying up code and docs. 2016-02-04 16:23:40 +00:00
Richard Davey
a8b04c4bf1 Merge pull request #2171 from mattrick16/dev
Add method to angle Display Objects relative to world
2016-02-04 18:21:14 +02:00
photonstorm
af4c938299 Docs update (#1967) 2016-02-04 16:05:45 +00:00
Richard Davey
8e6b88cda8 Merge pull request #2172 from jonjanisch/dev
Inconsistency in arcade.collide processCallback param order #667
2016-02-02 17:39:46 +02:00
Richard Davey
6a50e18bf0 Merge pull request #1610 from yigitozdemir/dev
On Ceiling Method Addition
2016-02-01 21:14:12 +02:00
Jonathan Janisch
24c85dbb35 Inconsistency in arcade.collide processCallback param order #667 2015-10-27 23:48:14 -04:00
mattrick
8843a4ad09 Add worldAngleToPointer 2015-10-27 16:55:23 -07:00
photonstorm
b91de47d8d Readme and JSDocs updates. 2015-10-13 12:01:08 +01:00
Christoph Dörfel
a8c4930d42 Add JsDoc comment for Body#addPhaserPolygon return value 2015-09-17 12:11:49 +02:00
Christoph Dörfel
4c9412088c Add option to prefix shape name and optimize JSON output 2015-09-16 14:00:24 +02:00
photonstorm
7487c15f0e Doc updates. 2015-09-08 15:56:28 +01:00
Christoph Dörfel
96441fdb27 Set correct default value for 'clearCallback' on P2.Body.removeCollisionGroup 2015-08-30 01:30:33 +02:00
Christoph Dörfel
2623ddeaf7 Convenience function to remove a collision group from a P2 Body 2015-08-30 00:19:37 +02:00
photonstorm
486c15f16f New docs. 2015-08-24 15:43:45 +01:00
photonstorm
55a7699381 Setting a P2.Body from Static or Kinematic to Dynamic will now automatically adjust the Body.mass to be 1 (thanks @wayfu #2005) 2015-08-20 11:19:30 +01:00
Richard Davey
4eb223f987 jsdocs fix. 2015-07-31 18:39:37 +01:00
Richard Davey
a56cd31638 jsdoc updates. 2015-07-31 18:39:37 +01:00
vrecluse
632c258d8d Fix p2 BodyDebug pixelsPerLengthUnit bug.
When mpx doesn’t return default value, the debug body size and position
goes wrong.
2015-07-31 00:04:32 +08:00
photonstorm
858ad51610 Phaser 2.4 release. 2015-07-22 15:31:30 +01:00
photonstorm
f15fe6706c All undefined argument checks were changed from if (typeof x === 'undefined') to if (x === undefined) removing the typeof check and saving some bytes across the codebase in the process. 2015-07-22 10:37:15 +01:00
Richard Davey
9e38bf974a World.stateChange is a new method that is called whenever the state changes or restarts. It resets the world x/y coordinates back to zero and then resets the Camera.
Sprites with Arcade Physics bodies that had `collideWorldBounds` enabled would be moved to the wrong position if you restarted a State (or swapped to a new State) that reset the world bounds (thanks @vulvulune #1775)
2015-07-22 01:24:26 +01:00
Richard Davey
6531552b32 Merge pull request #1905 from standardgaussian/aabbninja
AABB vs. AABB collision in Ninja
2015-07-16 15:45:09 +01:00
photonstorm
a0d57544c7 P2 updates finished. 2015-07-13 14:48:33 +01:00
photonstorm
956fa493a6 The P2.Body.onBeginContact arguments have changed. It now sends 5 arguments: The Phaser.P2.Body, the p2.Body, the p2 Shape from Body A, the p2 Shape from Body B and the contact equations array. Note that the Phaser.P2.Body may be null if you collide with a 'native' p2 body (such as the world bounds). However the p2.Body argument will always be populated.
The P2.Body.onEndContact arguments have changed. It now sends 4 arguments: The Phaser.P2.Body, the p2.Body, the p2 Shape from Body A and the p2 Shape from Body B. Note that the Phaser.P2.Body may be null if this is the end of a contact with a 'native' p2 body (such as the world bounds). However the p2.Body argument will always be populated.

Upgraded to p2.js 0.7.0
2015-07-13 11:44:04 +01:00
Standard Gaussian
b8710d7066 Removed unused local variables in Ninja.AABB.reportCollisionVsBody 2015-07-11 21:28:15 +01:00
Standard Gaussian
e7356e003f Implemented Ninja AABB vs AABB collisions 2015-07-11 21:04:16 +01:00
photonstorm
f48d038db3 Lots of jsdoc updates (#1644) 2015-07-08 15:10:41 +01:00
Richard Davey
f57d3c19e9 P2.Body.createGroupCallback incorrectly referenced the _groupCallbackContext when deleting it (thanks @Langerz82 #1886) 2015-07-07 01:24:26 +01:00
Standard Gaussian
a556dfdc69 Issue #1885: P2.enableBody now checks if an anchor exists on target object before attempting to set its value 2015-07-05 22:39:15 +01:00
Richard Davey
306fbf4d5c Merge pull request #1810 from Preece/tilemap-overlap
Sprite vs Tilemap can now check for overlap, without trying to separate
2015-06-17 01:38:42 +01:00
photonstorm
71cf2064ab Fixed TS defs and jsdoc for Ninja convertTilemap #1756 2015-06-16 19:10:01 +01:00
photonstorm
17831e0103 P2.Body.loadPolygon now allows the key parameter to be passed as null - when this happens the object parameter can be the actual physics object data instead of a string pointing to the cache, allowing you to take advantage of adding multiple convex shapes with automatic adjustments for center of mass #1801 2015-06-16 19:02:28 +01:00
photonstorm
58f4b07741 Clarified relationship between Sprite and BodyDebug #1795 2015-06-16 18:30:54 +01:00
photonstorm
c518fa32b7 Formatting. 2015-06-16 14:16:04 +01:00
Casey Clyde
e935df328d Sprite vs Tilemap can now check for overlap, without trying to separate 2015-05-23 22:39:12 -07:00
photonstorm
19f8a7316e ArcadePhysics.Body.syncBounds is a new property that if true forces the Body to check itself against the Sprite.getBounds() dimensions and adjust its width and height accordingly. If false it will compare its dimensions against the Sprite scale instead, and adjust its width height if the scale has changed. Typically you would need to enable syncBounds if your sprite is the child of a responsive display object such as a FlexLayer, or in any situation where the sprite scale doesn't change, but its parents scale is effecting the dimensions regardless. 2015-04-29 13:13:26 +01:00
photonstorm
432516fa0f Physics.Arcade.sort has a new property 'sortDirection'. If not specified it will use World.sortDirection. If the Group given as the first parameter has its physicsSortDirection property set that will override any other setting.
Physics.Arcade.sort now calls one of four functions: sortLeftRight, sortRightLeft, sortTopBottom and sortBottomTop. Each of which takes 2 Sprites as arguments.

Physics.Arcade.sort now doesn't bail out if the Group contains a mixture of physics and non-physics enabled objects, as the Group hash is now only ever populated with physics enabled objects. Also the sort comparison functions no longer return -1 if the bodies are invalid, but zero instead (#1721)
2015-04-13 16:29:34 +01:00
photonstorm
35bfe5fb2a Body.destroy now automatically calls Group.removeFromHash. 2015-04-13 16:27:43 +01:00
photonstorm
412338478c Added in all hooks required for MatterJS Physics (coming soon!) 2015-04-13 16:16:34 +01:00
photonstorm
04cb3889a9 P2.getConstraints would return an array of null objects. It now returns the raw p2 constraint objects (thanks @valueerrorx #1726) 2015-04-13 12:12:18 +01:00
Richard Davey
0b3fc61ba7 Merge pull request #1723 from dgoemans/dev
Fix for Phaser with requirejs
2015-04-13 11:29:58 +01:00
Chad Engler
b89cdd5a0c check for existence of sprite on body destroy 2015-04-12 17:30:54 -07:00
David Goemans
73bace335a Built a fix into p2.js v0.6.1 for using requirejs with phaser. This has also been put as a pull request to p2.js 2015-04-06 12:43:03 +02:00
photonstorm
ebdb6d028f The Physics Manager now has a new reset method which will reset the active physics systems. This is called automatically on a State swap (thanks @englercj #1691) 2015-03-24 10:21:12 +00:00
photonstorm
77eaa7e707 Optimised World.collideHandler and added SORT_NONE option. 2015-03-23 15:05:57 +00:00
photonstorm
b07ce89236 sourceWidth / Height now only set from the texture if the object has a texture. 2015-03-23 15:05:39 +00:00
photonstorm
ba052389a3 New version of p2.js merged for testing. 2015-03-23 10:11:49 +00:00
photonstorm
3f30a3d0d2 jsdocs updates. 2015-03-23 10:11:39 +00:00
Chad Engler
f5af981da3 fix missing semicolon 2015-03-22 21:28:27 -07:00
Chad Engler
97410f8907 add debug drawing for p2 capsule shape 2015-03-22 19:45:18 -07:00
breakosaur
bb600b4319 Fixed a few documentation typos. 2015-03-18 21:07:36 +00:00
Chad Engler
0b3850cc0c Fix debug drawing for p2 physics bodies 2015-03-18 01:19:32 -07:00
photonstorm
893d36f128 jsdoc fix. 2015-03-05 14:01:52 +00:00
photonstorm
2483cd5df4 Various readonly Body properties flagged as 'readonly' in the jsdocs (#1643) 2015-02-26 23:32:14 +00:00
photonstorm
f99f182a6f Arcade Physics is now using a spacial pre-sort for all Sprite vs. Group and Group vs. Group collisions. You can define the direction the sort will prioritise via the new sortDirection property. By default it is set to Phaser.Physics.Arcade.LEFT_RIGHT. For example if you are making a horizontally scrolling game, where the player starts on the left and moves to the right, then this sort order will allow the physics system to quickly eliminate any object to the right of the players bounds. This cuts down on the sheer volume of actual collision checks needing to be made. In a densely populated level it can improve fps rate dramatically.
There are 3 other directions available (`RIGHT_LEFT`, `TOP_BOTTOM` and `BOTTOM_TOP`) and which one you need will depend on your game type. If you were making a vertically scrolling shoot-em-up then you'd pick `BOTTOM_TOP` so it sorts all objects above and can bail out quickly.

More importantly you can switch the `sortDirection` at run-time with no loss of performance. Just make sure you do it *before* running any collision checks. So if you had a large 8-way scrolling world you could set the `sortDirection` to match the direction the player was moving in and adjust it in real-time, getting the benefits as you go. My thanks to Aaron Lahman for inspiring this update.
2015-02-26 21:24:07 +00:00
photonstorm
03a2db18cb Added extra protection in the case of mixed-type Groups.
Removed window vars and replaced with stats property.
Removed redundant if/else checks.
2015-02-25 06:06:40 +00:00