Commit graph

1019 commits

Author SHA1 Message Date
Richard Davey
db613c793a Merge branch 'master' of https://github.com/photonstorm/phaser 2018-03-21 03:17:00 +00:00
Richard Davey
2f86100f87 MatterGameObject is a new function, available via the Matter Factory in this.matter.add.gameObject, that will inject a Matter JS Body into any Game Object, such as a Text object. 2018-03-21 03:16:36 +00:00
Richard Davey
5cae6d38b3 Matter.SetBody and SetExistingBody will now set the origin of the Game Object to be the Matter JS sprite.xOffset and yOffset values, which will auto-center the Game Object to the origin of the body, regardless of shape. 2018-03-21 03:16:01 +00:00
orblazer
7fba122321 Fix "any" types 2018-03-20 17:15:49 +01:00
orblazer
dca7996179 Fix multiple types on Physics, Texture and Input 2018-03-20 16:10:19 +01:00
orblazer
4cff464555 Fix nullable types 2018-03-20 15:36:03 +01:00
orblazer
fa13b597e3 Add more callbacks 2018-03-19 23:08:05 +01:00
orblazer
f30218d3d3 Add callbacks on Physics 2018-03-19 21:42:07 +01:00
Richard Davey
19a08286c0 More types added 2018-03-19 15:01:14 +00:00
Richard Davey
620bcc6ae5 jsdoc fixes and additions 2018-03-19 13:45:00 +00:00
orblazer
ae15eca7bd Update JSDoc on "Matter.JS" physics 2018-03-19 01:10:32 +01:00
orblazer
2da6a2bffe Update JSDoc on "Impact" physics 2018-03-19 00:42:09 +01:00
orblazer
af3c03a3cb Update JSDoc on "Arcade" physics 2018-03-19 00:29:46 +01:00
Richard Davey
edeb63ebbd eslint fix 2018-03-18 14:21:53 +00:00
Richard Davey
3d4be64331 Testing MatterGameObject 2018-03-17 18:07:05 +00:00
Richard Davey
05a4385cd7 jsdoc fixes 2018-03-16 17:29:39 +00:00
Richard Davey
a524dc44b0 Expose constants. Fix #3387 2018-03-16 13:29:30 +00:00
Richard Davey
7a8e4cf5e1
Merge pull request #3366 from samme/feature/world-wrap
Add Arcade.World wrap methods and Actions.WrapInRectangle
2018-03-16 12:58:16 +00:00
Sean Bohan
4cde28fecd Forgot to devide width by 2 2018-03-16 14:02:41 +08:00
Sean Bohan
72e82ecf48 Fix debug draw of scaled arcade body 2018-03-16 14:02:41 +08:00
samme
4b25574d82 Expect v3.3.0 2018-03-12 07:29:49 -07:00
samme
66e5a72dae Add Phaser.Physics.Arcade.World#wrap and friends
- Phaser.Physics.Arcade.World#wrap
- Phaser.Physics.Arcade.World#wrapArray
- Phaser.Physics.Arcade.World#wrapObject
2018-03-10 13:36:18 -08:00
Samid\Sami
f5e471dad7 removed trailing space for JSHint validation. 2018-03-08 11:46:01 +01:00
Samid\Sami
84481da4d1 * Fix #3345 by adding beginPath and closePath when done drawing in postUpdate. 2018-03-08 11:16:04 +01:00
Patrick Galbraith
8eb82e4fcb
Fix for collideGroupVsSelf is undefined
This happens when you call collide with a single group as the first param.

Seems like the `collideGroupVsSelf` function was not implemented. I've changed it to just call the `collideGroupVsGroup` with the first object twice which worked when I tested it on my project.
2018-03-05 21:15:38 +10:30
Sean Bohan
3f2e63fc17 Fix arcade body does not align with scaled parent object.
When a game object scaled, arcade body still calculate its position based on its original size instead of scaled one.
2018-03-01 09:02:04 +08:00
Richard Davey
1cae348300
Merge pull request #3278 from nkholski/arcadeGroups
Groups arcade collision
2018-02-28 20:56:11 +00:00
Richard Davey
218b4e4a52
Merge pull request #3285 from samme/docs/onWorldBounds
Describe Arcade.Body#onWorldBounds
2018-02-28 20:48:31 +00:00
Richard Davey
921d7e317a Arcade Physics Bodies didn't apply the results of allowRotation to the parent Game Object. 2018-02-27 01:08:55 +00:00
samme
36d91e9955 Describe Arcade.Body#onWorldBounds 2018-02-26 11:27:57 -08:00
Niklas Berg
b87d71ab73 single out groups without physics 2018-02-24 08:44:38 +01:00
Niklas Berg
b9e4d15efb Groups arcade collisions 2018-02-23 23:49:12 +01:00
samme
64e5b4394a Fix 'static is a reserved word in strict mode' 2018-02-18 10:38:08 -08:00
Richard Davey
3c65121cb3 eslint fixes 2018-02-16 19:17:49 +00:00
Richard Davey
d23688c3e4 Added eslint fixes and overrides 2018-02-16 18:44:07 +00:00
Richard Davey
3f155bf8f3 World didn't import GetOverlapX or GetOverlapY, causing separateCircle to break. 2018-02-16 18:43:06 +00:00
Richard Davey
86f00eeb52 eslint fixes 2018-02-16 18:17:51 +00:00
Richard Davey
4e6df03512 Updated semver 2018-02-15 14:31:15 +00:00
Richard Davey
aa9cac4ba8 Added refreshBody method and jsdocs 2018-02-15 01:52:01 +00:00
Richard Davey
7df00ccb6f Removed un-used properties from the Static Body
Set un-used Vectors to use the Vec2 ZERO constant to save object creation.
Added setGameObject and updateFromGameObject methods.
2018-02-15 01:51:36 +00:00
Richard Davey
4cc7fed1dd Added World.pendingDestroy Set and process it during postUpdate. 2018-02-15 01:50:22 +00:00
Richard Davey
b36dd17430 Removed pendingDestroy and opted for easier Set iteration.
Updated Body.reset so it resets the Sprite as well, otherwise the Body remains stuck on the next update loop.
2018-02-15 01:49:55 +00:00
Richard Davey
e68329f763 Fixed version numbers 2018-02-14 19:55:00 +00:00
Richard Davey
24e8f7a119 Body.destroy is now flag based, cleared by the World.
Added pendingDestroy flag to handle body destruction within events or collider iterations.
2018-02-14 19:36:34 +00:00
Richard Davey
81d0a48c58 disableBody renamed disableGameObjectBody
disableBody now disables just a body object.
destroying a body sets its `pendingDestroy` flag, which is now cleared in the postUpdate method.
Group vs. Group collision has been implemented.
World.destroy properly clears down its Sets and RTrees.
2018-02-14 19:35:57 +00:00
Richard Davey
b7beea1d37 Impact bodies now remove themselves from the world when destroyed. 2018-02-14 19:34:21 +00:00
Richard Davey
b81b268b29 Matter JS bodies now have a destroy method that removes them from the world. 2018-02-14 19:33:56 +00:00
Richard Davey
c6f4a6ed43 Arcade Physics Colliders have a name property and setName method. 2018-02-14 19:33:33 +00:00
Richard Davey
8f4a1012fd Updated jsdocs. 2018-02-13 01:39:22 +00:00
Richard Davey
2813ac8162 Moved PluginManager and merged configs into single root file for easier changing. 2018-02-12 23:03:48 +00:00
Richard Davey
d1f5f8a82b Added jsdocs 2018-02-12 16:01:21 +00:00
Richard Davey
eaca4eb462 Added jsdocs 2018-02-12 13:48:53 +00:00
Richard Davey
e448ec59f0 Added removeConstraint method. 2018-02-12 13:48:52 +00:00
Richard Davey
d421e9264e Fixed #3145 2018-02-12 13:48:49 +00:00
Richard Davey
8de078d333 Added jsdocs 2018-02-12 13:48:48 +00:00
Richard Davey
92db8cfa2c Added jsdocs and fix #3179 2018-02-12 13:48:48 +00:00
Richard Davey
d3cb0761d2 Updated jsdocs. 2018-02-09 16:52:19 +00:00
Richard Davey
2434bb187a Added jsdocs. 2018-02-09 16:52:18 +00:00
Richard Davey
c7a84a1f7a
Merge pull request #3209 from vulcanoidlogic/master
matterjs PointerConstraint.js world.events.on undefined
2018-02-09 16:51:52 +00:00
Richard Davey
5db058021f Added jsdocs. 2018-02-09 15:23:33 +00:00
Richard Davey
73833e6628 Fixed require path. 2018-02-09 15:23:12 +00:00
Greg
79b61defe6 #3200 Errors in Input Mouse Events examples 2018-02-09 00:21:08 -05:00
Richard Davey
c1b5ff885e Added jsdocs 2018-02-09 04:08:01 +00:00
Richard Davey
e0899bfa00 Added jsdocs 2018-02-09 03:44:23 +00:00
Richard Davey
91887815f6 Merged Arcade Physics methods and added jsdocs 2018-02-09 01:40:41 +00:00
Richard Davey
10193c181a Fixed require paths. 2018-02-07 17:10:01 +00:00
Richard Davey
40689d1e35 Updated jsdocs. 2018-02-07 15:27:21 +00:00
Richard Davey
2a86400a28 Added in jsdocs 2018-01-31 13:54:44 +00:00
Richard Davey
f1a25921c7 Fixed missing Pipeline component. 2018-01-30 19:16:00 +00:00
Michael Hadley
16767927cb Bug fix: setExisting -> setExistingBody 2018-01-28 08:06:05 -06:00
Michael Hadley
7acd9b0381 Tiled object parser: store points as xy objects instead of arrays
V2 used arrays, but other places in the codebase (and users) will expect an object with XY props over an array.
2018-01-27 08:34:11 -06:00
Michael Hadley
cbc493df98 MatterTileBody bug fix: tile -> this.tile 2018-01-26 22:31:53 -06:00
Michael Hadley
801d2e92e1 Revert "Add matter component for inertia - useful for platformers"
This reverts commit 2b20c8bbfb.
2018-01-26 21:51:20 -06:00
Michael Hadley
ec444f876e Extend SetBody component with setExistingBody method
This makes it easy to add compound bodies to a MatterSprite/MatterImage
2018-01-26 21:50:22 -06:00
Michael Hadley
0d84860a8a Update Matter.World to render compound bodies 2018-01-26 21:50:21 -06:00
Michael Hadley
2b20c8bbfb Add matter component for inertia - useful for platformers 2018-01-25 16:05:49 -06:00
Michael Hadley
08df6b4cb0 Bug fix: wrong prop name 2018-01-25 15:34:25 -06:00
Michael Hadley
7730af643d Add better support for concave polygons to MatterTileBody 2018-01-25 15:17:33 -06:00
Michael Hadley
578fe59110 Add scale support to MatterTileBody 2018-01-25 15:17:10 -06:00
Michael Hadley
64d172546c JSDoc Matter.World#convertTilemapLayer & Matter.World#convertTiles 2018-01-25 14:04:58 -06:00
Michael Hadley
27930fb4bb JSDoc MatterTileBody 2018-01-25 13:58:03 -06:00
Michael Hadley
92fb2a9c21 Update MatterTileBody to use latest Tile API 2018-01-25 13:49:28 -06:00
Michael Hadley
a6556e9364 Expose Phaser.Physics.Matter.TileBody 2018-01-25 13:48:47 -06:00
Michael Hadley
6776b94c5b Allow Impact.Sprite#setVelocity to accept 1 parameter 2018-01-25 08:45:40 -06:00
Michael Hadley
2c1f10b0b4 setCollisionMapFromTilemapLayer - load slope mapping via object or Tiled properties 2018-01-23 22:00:01 -06:00
Michael Hadley
ccdad43920 Matter world and factory methods for creating a tile body 2018-01-21 12:53:48 -06:00
Michael Hadley
348da8c81e MatterTileBody: wrapper around a Tile that provides access to a matter body 2018-01-21 12:53:27 -06:00
Michael Hadley
a6365c5339 Removing es6 'let' from AP vs tilemap 2018-01-19 06:56:52 -06:00
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
photonstorm
8aec760cd5 First pass at spacial sorting in World.collide. 2015-02-25 05:39:02 +00:00
photonstorm
a69e53f901 Copyright date change. 2015-02-25 03:36:23 +00:00
photonstorm
dee13d52d8 jshint fix. 2015-02-25 02:50:57 +00:00
photonstorm
c799dfe7da Fixed physics postUpdate issue causing particles and all kinds of things to go awry. 2015-02-25 02:18:05 +00:00
photonstorm
3d399f1b14 Removed the final few private vars from computeVelocity 2015-02-25 00:04:53 +00:00
photonstorm
42b316473d jsdoc fix. 2015-02-23 13:58:57 +00:00
photonstorm
a7bdce1806 Moved collideSpriteVsTilemapLayer to here. 2015-02-19 05:00:22 +00:00
photonstorm
eb732e1d90 Refactored ArcadePhysics.World to remove global property use and array length caches. 2015-02-19 04:59:55 +00:00
photonstorm
052b9a7e06 Separated the Tilemap specific code from World. 2015-02-17 15:49:53 +00:00
photonstorm
4bb1adcf36 Typo fix. 2015-02-17 06:00:18 +00:00
photonstorm
1229c791b3 Added Body.dirty flag (reserved for future use) 2015-02-17 05:13:54 +00:00
photonstorm
0588f95f4c Body.phase renamed to Body.dirty. 2015-02-17 05:13:36 +00:00
photonstorm
86f05160b7 Removed array length vars and added strict equalities. 2015-02-17 05:13:12 +00:00
photonstorm
8483eac6aa Removing all use of _cache from all Game Objects. 2015-02-16 17:22:51 +00:00
photonstorm
f60b2b7635 World.setBounds if called after you had already started P2 Physics would incorrectly create a new collision group for the wall objects. P2.World now remembers the settings you provide for each wall and the collision group, and re-applies these settings should the world dimensions ever change (thanks @nextht #1455) 2015-02-11 22:33:29 +00:00
yigitozdemir
9ad1230257 On Ceiling Method Added 2015-02-11 01:36:35 +02:00
photonstorm
18ff04810f ArcadePhysics.distanceToPointer now calculates the distance in world space values.
ArcadePhysics.moveToPointer no longer goes crazy if the maxTime parameter is given and the Sprite is positioned in a larger game world (thanks @AnderbergE #1472)
2015-02-10 22:16:35 +00:00
photonstorm
816a80f39a If Body.customSeparateX or customSeparateY is true then the Body will no longer be automatically separated from a **Tilemap** collision or exchange any velocity. The amount of pixels that the Body has intersected the tile is available in Body.overlapX and overlapY, so you can use these values to perform your own separation in your collision callback (#992) 2015-02-10 12:58:12 +00:00
photonstorm
6081aa360f P2.Body.clearCollision default values were incorrectly set to false if no parameters were provided, even though the docs said they were true (thanks @brianbunch #1597) 2015-02-08 21:57:08 +00:00
photonstorm
d710caed9e Body.reset now resets the Body.speed value to zero. 2015-02-05 05:12:31 +00:00
Richard Davey
66ad09ebd0 Merge pull request #1549 from tomlarkworthy/fixAdjustMass
Bug fix: adjust mass and debug body gfx
2015-02-03 21:12:15 +00:00
Richard Davey
0953e927b4 Merge pull request #1559 from vulvulune/dev
Complete "tsdocs" tasks to download plugins + improve ts doc + grunt:jsdoc
2015-02-03 21:04:30 +00:00
Richard Davey
21823f65e3 Merge pull request #1576 from vulvulune/jsdoc
Correct comments
2015-02-03 20:47:32 +00:00
Richard Davey
9efca46021 Merge pull request #1582 from micahjohnston/dev
Fix doc comment on Phaser.Physics.Arcade#getObjectsAtLocation.
2015-02-03 20:45:33 +00:00
zekoff
0ccd225e08 Allow max of 0 in computeVelocity
Previous method of setting default max did not allow falsey values.
2015-02-03 11:36:53 -06:00
Micah Johnston
34d443153f fix argument name in comment on Phaser.Physics.Arcade#getObjectsAtLocation. 2015-01-30 05:48:34 -07:00
Micah Johnston
401d2fe847 Fix doc comment on Phaser.Physics.Arcade#getObjectsAtLocation. 2015-01-29 18:13:03 -07:00
photonstorm
d6ea8fb956 jsdoc updates (spelling mistakes, code formatting, etc) 2015-01-28 17:18:33 +00:00
vulvulune
1aab540a6f Correct comment Phaser.Physics.P2.BodyDebug
Set correct method name in comments
2015-01-27 15:26:05 +01:00
vulvulune
7be4b8d7a9 Replace the grunt docs tasks with grunt-jsdoc
Replace builddoc and exportdocjson grunt tasks with grunt-jsdoc.
To avoid an error I added a fake comment to a @todo param in the p2.js
file.
2015-01-22 16:22:51 +01:00
photonstorm
587c3e5f6a Arcade.Body.friction allows you to have more fine-grained control over the amount of velocity passed between bodies on collision. 2015-01-18 12:24:00 +00:00
Tom Larkworthy
4b32505383 calling adjust mass desyncs the debug graphics from the real positions of bodies 2015-01-17 21:15:10 -08:00
photonstorm
0f42b530eb Physics.Arcade.isPaused allows you to toggle Arcade Physics processing on and off. If true the Body.preUpdate method will be skipped, halting all motion for all bodies. Note that other methods such as collide will still work, so be careful not to call them on paused bodies. 2015-01-10 00:30:02 +00:00
photonstorm
8cd98e2e36 jsdocs fixes. 2015-01-05 10:59:10 +00:00
photonstorm
15d5b54c26 Removed redundant updateTransform call. 2015-01-02 04:15:27 +00:00
Richard Davey
3c4a9720c6 Body updateTransform patch re: #1493 and #1490 2015-01-01 12:33:43 +00:00
photonstorm
965fbc96e7 Typo fixes :) 2014-12-11 22:30:24 +00:00
photonstorm
3c564a33b6 The P2 World constructor wouldn't let you use your own config unless you specified both the gravity *and* broadphase. Now allows one or both (thanks @englercj #1412) 2014-12-11 22:04:45 +00:00
photonstorm
4abb1550d7 P2.postBroadphaserHandler updated to avoid skipping final 2 pairs. 2014-12-11 22:00:06 +00:00
Paul
dab8772de0 Documentation - consistency updates
- Updated `readOnly` doclet to `readonly`

- `array` refined to `type[]`, where such information was immediately
determinable.

- Updated {Any}/{*} to {any}; {...*} is standard exception

- Udated {Object} to {object}
2014-11-30 04:03:35 -08:00
photonstorm
667d477a16 P2.BodyDebug always lagged behind the position of the Body it was tracking by one frame, which became visible at high speeds. It now syncs its position in the Body.postUpdate which prevents this from happening (thanks @valueerror) 2014-11-25 22:21:11 +00:00
photonstorm
7aaa63e7a5 When you change State the P2 Physics world is no longer fully cleared. All of the bodies, springs, fixtures, materials and constraints are removed - but config settings such as gravity, restitution, the contact solver, etc are all retained. The P2.World object is only created the very first time you call Physics.startSystem. Every subsequent call hits P2.World.reset instead (#1292) 2014-11-25 12:09:03 +00:00
Pete Baron
bc70ce74b5 Minor logic fix to nested loop counters. 2014-11-12 15:00:26 +13:00
Pete Baron
1c7059ea6c Merge remote-tracking branch 'phaser-github/dev' into dev
Conflicts:
	src/animation/FrameData.js
	src/core/Game.js
	src/particles/arcade/Emitter.js
	src/time/Time.js
	src/tween/Tween.js
2014-11-12 13:03:52 +13:00
Pete Baron
af09290cbf Add getObjectsAtLocation method in Arcade physics. 2014-11-12 11:24:38 +13:00
photonstorm
8bf93fb658 ArcadePhysics.skipQuadTree is now set to true by default. A QuadTree is a wonderful thing if the objects in your game are well spaced out. But in tightly packed games, especially those with tilemaps or single-screen games, they are a considerable performance drain and eat up CPU. We've taken the decision to disable the Arcade Physics QuadTree by default. It's all still in there and can be re-enabled via game.physics.arcade.skipQuadTree = false, but please only do so if you're sure your game benefits from this. 2014-11-11 01:05:58 +00:00
photonstorm
0f3849491d P2.BodyDebug circles were drawing at half widths (thanks @enriqueto #1288) 2014-11-08 14:09:26 +00:00
Pete Baron
497e919e43 Adjusted particle emitter for slow-mo.
Removed un-needed physics changes.
2014-11-03 13:01:14 +13:00
Pete Baron
0da8c6cb1a Established fixed steps for logic update with catch-up for dropped frames.
Render update runs every frame.
Tweens moved into render update to maintain smooth motion.
Added Time.slowMotion factor, integrated with logic/render updates and tweens.
2014-11-03 12:02:43 +13:00
photonstorm
96fd0ade74 JSDoc fixes. 2014-10-21 22:43:42 +01:00
photonstorm
00b5472d4c jshint fixes. 2014-09-29 12:29:18 +01:00
photonstorm
b0e96a37b9 Added Box2D handler support. 2014-09-29 12:27:28 +01:00
DanX
3a1ec3c5c1 Fix docs for collide and collideHandler 2014-09-26 22:37:11 -03:00
photonstorm
20551f9129 Lots of jsdocs fixes ready for the new doc generator. 2014-09-16 17:35:08 +01:00
photonstorm
5eedc4c2c5 The physics config object is now stored locally in World.config. 2014-09-09 12:49:31 +01:00
photonstorm
59f7c53019 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. 2014-09-08 22:34:53 +01:00
Richard Davey
55400ce988 World.createDistanceConstraint signature changed to include new local anchors (thanks @rhmoller #1169) 2014-09-04 22:22:10 +01:00
photonstorm
865c6878bf P2.World.getSprings used to return an empty array, but now returns all the Springs in the world (#1134) 2014-09-02 15:06:43 +01:00
Carlos Martinez
ec9a8b6903 Firxed for travis build. 2014-09-01 15:03:29 +01:00
Carlos Martinez
9843818f30 Merge branch 'dev' of https://github.com/photonstorm/phaser into dev 2014-09-01 14:19:50 +01:00
Carlos Martinez
0640cc0c03 Added support to pass 2 array in Arcade collide and overlap (response to an issue). 2014-09-01 14:01:36 +01:00
photonstorm
070e33f1e7 ArcadePhysics.overlap has been updated so that the Body.overlapX/Y properties are set to the amount the two bodies overlapped by. Previously they were zero and only populated during the separation phase, but now the data is available for just overlap checks as well. You can then use these values in your ovrelap callback as required - note that they are changed for every check, so a Sprite overlap tested against 10 other sprites will have the overlapX/Y values updated 10 times in a single collision pass, so you can only safely use the values in the callback (#641) 2014-09-01 03:54:55 +01:00
photonstorm
9b6ffc3f94 Moved Springs to not extend p2 Springs as they break when added to the p2.World. Springs and spring removal now working properly (#1134) 2014-08-29 14:13:20 +01:00
photonstorm
69b9e5eb7c Arcade.overlap and collide are now more consistent about allowing a Group vs. Group or Group vs. Array of Groups set (thanks @pyromanfo #877 #1147) 2014-08-29 01:28:43 +01:00
Richard Davey
32989094f4 Merge pull request #1147 from pyromanfo/dev
Fix for group vs group within group collision (fixes #877)
2014-08-29 01:27:01 +01:00
Allen Cook
5a3eeb8a9c Fix for group vs group within group collision (fixes #877) 2014-08-28 20:23:02 -04:00
photonstorm
dd160f004b jsdocs update for collideWorldBounds #1010 2014-08-29 01:16:05 +01:00
photonstorm
6fbaa36ddd P2.PointProxy.mx and my values are get and set in meters with no pixel conversion taking place.
P2.InversePointProxy.mx and my values are get and set in meters with no pixel conversion taking place.
P2.PointProxy.x and y values are now returned in pixels (previously they were returned in meters). See PointProxy.mx/my for meter values.
P2.InversePointProxy.x and y values are now returned in pixels (previously they were returned in meters). See PointProxy.mx/my for meter values.
2014-08-28 17:04:58 +01:00
photonstorm
a7d9b2c8c5 The P2.World.postBroadphaseHandler now checks if the returned pairs array is empty or not before processing it (thanks @wayfu #934) 2014-08-28 04:24:08 +01:00
photonstorm
0f207c47a7 Calling P2.Body.destroy or ArcadePhysics.Body.destroy wouldn't null the parent sprite body, causing it to error in the next update (thanks @jonathanhooker #1077) 2014-08-28 03:44:02 +01:00
photonstorm
ec687868de Input.setMoveCallback has been removed due to deprecation.
BitmapData.refreshBuffer has been removed and replaced with BitmapData.update.
BitmapData.drawSprite has been removed due to deprecation. Use BitmapData.draw instead.
Pointer.moveCallback has been removed due to deprecation.
SinglePad.addButton has been removed due to deprecation.
P2.Body.loadData has been removed due to deprecation.
P2.World.defaultFriction and defaultRestitution have been removed due to deprecation.
Canvas.create noCocoon parameter has been removed due to deprecation.
Color.getColorInfo, RGBtoHexstring, RGBtoWebstring and colorToHexstring has been removed due to deprecation.
2014-08-28 03:40:59 +01:00
photonstorm
c87aa5103d Fixed the RevoluteConstraint worldPivot and moved it to the end of the signature to minimise code changes. 2014-08-28 01:14:59 +01:00
photonstorm
aeb82dbee9 World.createRotationalSpring will now let you create rotational springs. 2014-08-28 00:58:50 +01:00
photonstorm
6acc8bf9f2 World.enableBodySleeping has been removed and replaced with World.sleepMode. 2014-08-28 00:45:57 +01:00
photonstorm
98ccae56de P2.Body now uses the new Body.type value instead of Body.motionState, however as P2.Body already have a property called type we have left the motionState getter/setter in for now. 2014-08-28 00:39:47 +01:00
photonstorm
4935a4e4af RevoluteConstraint fixed for new version of p2. 2014-08-28 00:24:56 +01:00
photonstorm
b25bdf3523 Fixed the DistanceConstraint parameters. 2014-08-28 00:15:28 +01:00
photonstorm
504b69ffaa Updated p2.js to d1c7a340c42e4d5d1d939fba5fd13c5e49d6abd2
Updated grunt replace task to match p2s new UMD signature.
2014-08-28 00:01:35 +01:00
photonstorm
36ecd81f29 Arcade Physics Body.skipQuadTree is a new boolean that if set to true when you collide the Sprite against a Group it will tell Phaser to skip using a QuadTree for that collision. This is handy if this Body is especially large.
Arcade Physics World.skipQuadTree will disable the use of all QuadTrees in collision methods, which can help performance in tightly packed scenes.
2014-08-04 13:04:11 +01:00
Richard Davey
acceb692c3 Merge pull request #1071 from Dumtard/dev
Fix for previous PR #1028
2014-07-31 13:48:15 +01:00
photonstorm
9bbc8ecce3 Phaser.Physics.P2.addPolygon now takes a nested array again (thanks @wayfu #1060) 2014-07-31 13:39:26 +01:00
Charles Black
a90ab2e59b P2 bounds now collides with everything by default 2014-07-27 16:06:55 -04:00
photonstorm
d72e199291 Physics.bounds now correctly matches World.bounds on system start (thanks @Dumtard #1028) 2014-07-16 00:14:47 +01:00
Petar Petrov
78771d875b Fix issue #883
Check if points is an Array before parsing arguments.
2014-07-12 22:50:48 +02:00
photonstorm
2293b64c94 Removing debug / console.log output. 2014-07-09 05:49:13 +01:00
Richard Davey
6ce183189f Merge pull request #971 from psalaets/issue-970
reorder param list of Phaser.Physics.Arcade.Body.render
2014-07-07 10:29:51 +01:00
Paul Salaets
cbf0a9011a remove a little duplication 2014-07-05 21:53:32 -04:00
Paul Salaets
0c15ef6adc move shape specific debug rendering into the shapes 2014-07-05 21:29:28 -04:00
Paul Salaets
77b86f43e3 support for debug rendering ninja AABB and circle bodies 2014-07-05 20:58:33 -04:00
Paul Salaets
79f550bc89 updating comments: default color and method name 2014-07-05 18:08:00 -04:00
Paul Salaets
0694dab909 reorder param list to be consistent with comment's ordering and other code 2014-07-05 17:50:13 -04:00
photonstorm
6e94aa7cde Updated applyForce docs. 2014-07-02 16:29:30 +01:00
Richard Davey
a425470f41 Merge pull request #925 from jonkelling/dev
Fix for issue #917, Physics.P2.Body#addToWorld
2014-07-01 15:52:29 +01:00
Richard Davey
ba29d5bd4b Merge pull request #910 from TatumCreative/dev
Fix null returns for play()
2014-07-01 15:39:17 +01:00
Richard Davey
117aef650b Merge pull request #956 from Phaiax/phaserdts-createcollisiongroup
createCollisionGroup -> public, included in .d.ts file
2014-07-01 15:37:31 +01:00
Richard Davey
2fb9217776 Merge pull request #955 from Phaiax/issue952-p2bounds
P2 bottom world wall position fix
2014-07-01 15:36:02 +01:00
Richard Davey
1a0ebe6d26 Merge pull request #954 from Phaiax/issue953-bodydebug
inverting debug getter result
2014-07-01 15:35:35 +01:00
Phaiax
00bf349ff5 Body.enable only exists in Arcade physics, so move conditions concerning this into arcarde 2014-06-30 12:49:53 +02:00
Phaiax
18229d1673 fix jshint warning 2014-06-29 18:23:43 +02:00
Phaiax
394e70db06 inverting debug getter result 2014-06-28 01:33:02 +02:00
Phaiax
441d0a816e P2 bottom world wall position fix 2014-06-28 01:28:59 +02:00
Phaiax
961d25cadc createCollisionGroup -> public, included in .d.ts file 2014-06-28 01:25:51 +02:00
photonstorm
cd60554c78 Added P2 body anchor docs to clarify #938 2014-06-23 23:34:27 +01:00
jonkelling
36d70697db Fix for issue #917, Physics.P2.Body#addToWorld
Fix for issue #917: Calling reset() on Sprite with a P2 body can result in body.data.world == null.
Calling addToWorld() would previously not check the _toRemove array, which could, if the timing were right, result in a Sprite being revived but then removed from the P2 World--the result of this being the Sprite's data would be in a mixed state causing it to appear visually but not function in the world.
2014-06-17 21:53:20 -05:00
Greg Tatum
50f91eae54 Shape changed not called on removeShape
It looks like a bunch of these methods that modify the body don't call shapeChanged(). If you want I can add them all and resubmit.
2014-06-17 08:36:39 -05:00
photonstorm
69525799d7 New build files for testing. 2014-06-11 12:46:49 +01:00
photonstorm
50e47d89ee ArcadePhysics.Body.setSize if you set offset x/y values previously and then passed zero values they would be ignored (thanks @casensiom fix #889) 2014-06-11 00:21:04 +01:00
Richard Davey
13700148fb Merge pull request #891 from aivins/issue890
Separate from TilemapLayer after custom callbacks.
2014-06-11 00:00:20 +01:00
Lewis Lane
a16cb3f5a2 Added notes to overlap/collide regarding non-recursiveness
Made it clear that the overlap and collide methods do not recursively check for collisions, i.e. in the case of being passed a Group containing other Groups or Tilemaps.
2014-06-09 08:05:23 +01:00
Andrew Ivins
ccd914620d Separate from TilemapLayer after custom callbacks. 2014-06-09 14:28:14 +08:00
photonstorm
9c35dfde0c ArcadePhysics.Body has a new boolean property enable. If false the body won't be checked for any collision or overlaps, or have its pre or post update methods called. Use this for easy toggling of physics bodies without having to destroy or re-create the Body object itself. 2014-05-27 11:22:58 +01:00
photonstorm
88306b6e12 P2 World array reset fix. 2014-05-20 10:03:00 +01:00
photonstorm
2b40c8a7c7 Pointer.type and Pointer.exists properties added.
QuadTree.retrieve can now accept either a Sprite with a physics body or a Phaser.Rectangle as its parameter.
ArcadePhysics.getObjectsUnderPointer will return all children from a Group that overlap with the given Pointer.
2014-05-06 02:45:10 +01:00
photonstorm
bd4c2176f0 Added an additional tile index check to P2.World.convertTilemap. 2014-05-01 02:40:17 +01:00
photonstorm
b40769019b The P2 DistanceConstraint method signature has changed. Updated Phaser so maxForce is now passed as object (fix #788) 2014-04-30 16:54:56 +01:00
photonstorm
fa613c5fe1 ScaleManager seeds _check private var with null to avoid later comparison check (thanks @jflowers45, fix #782)
P2.Body.applyForce should have used pxmi instead of pxm (thanks @Trufi, fix #776)
P2 fixed creation of RevoluteConstraint by passing maxForce in the options (thanks @woutercommandeur, fix #783)
2014-04-29 19:34:38 +01:00
Wouter Commandeur
b1953bd0a0 fix creation of RevoluteConstraint by passing maxForce in the options 2014-04-29 20:12:56 +02:00
photonstorm
1d37cde66f Updated p2 to latest build and patched for Float32Array + UMD issues. 2014-04-29 02:34:16 +01:00
photonstorm
251bc10327 jshint fixes. 2014-04-25 02:52:14 +01:00
Georgios Kaleadis
33fc41a9b0 fix comment 2014-04-24 11:59:55 +02:00
Georgios Kaleadis
339da73160 pausable p2 world 2014-04-24 11:56:52 +02:00
photonstorm
4ec5665148 Fixed #750 - Invalid typescript mapping for TileSprite.autoScroll function in TS defs.
Game checks if window.console exists before using it (should fix IE9 issues when dev tools are closed), however it is still used deeper in Pixi.
Body.loadData flagged as deprecated.
2014-04-22 23:31:07 +01:00
photonstorm
944e03ddb8 P2.Body.loadPolygon has been updated to correct center of mass issues (thanks @georgiee, fix #749) 2014-04-22 22:33:25 +01:00
Georgios Kaleadis
c0189c02c1 fixed loadPolygon center of mass 2014-04-22 19:56:25 +02:00
Opher Vishnia
22b62726ad Fixed typo in world.setMaterial
The function contained a typo: bodies is an Array and so bodies.setMaterial is undefined
2014-04-19 19:39:50 +03:00
photonstorm
713bd203ee ArcadePhysics.collideSpriteVsGroup checks if Sprite has a body before carrying on, now safely skips sub-groups or other non-Sprite group children.
QuadTree.retrieve now checks to see if the given Sprite has a body before carrying on.
2014-04-17 12:31:14 +01:00
photonstorm
3b73c17997 ArcadePhysics.Body.phase is checked in postUpdate to prevent it from being called multiple times in a single frame. 2014-04-15 02:50:25 +01:00
photonstorm
e9cb345261 P2.World.convertTilemap now correctly checks the collides parameter of the tiles as it converts them. 2014-04-14 13:52:53 +01:00
photonstorm
a2b2d558a5 jsdoc and jshint fixes. 2014-04-11 03:02:19 +01:00
photonstorm
77f8e5eefc P2 Fixtures Collection Class (@georgiee please test it works ok! #704) 2014-04-11 00:43:30 +01:00
Richard Davey
b7b1e7428a Merge pull request #704 from georgiee/fixture-list
P2 Fixtures Collection Class
2014-04-11 00:19:05 +01:00
photonstorm
a01cc2e1ca Objects with an InputHandler now deactivate it when the object is removed from a Group but not destroyed (fix #672)
Lots of jsdoc fixes in Body and World.
Removed un-used events from World (such as onImpact).
2014-04-11 00:06:22 +01:00
Georgios Kaleadis
13e5cacd71 added a p2 fixture collections helper class 2014-04-10 23:45:35 +02:00
Georgios Kaleadis
1213cae0a4 additionally save fixtures by key 2014-04-10 21:28:14 +02:00
photonstorm
289b5b2532 Removed un-used vars. 2014-04-10 17:25:35 +01:00
photonstorm
9ddcc5d0ea p2.World.defaultRestitution has been deprecated and is now p2.World.restitution.
p2.World.defaultFriction has been deprecated and is now p2.World.friction.
p2.World now uses 4 bodies for the world boundaries, rather than 1 body with 4 shapes. This helps the broadphase massively.
p2.World bounds are now included in the callback events such as beginContact and impact events.
2014-04-10 17:11:16 +01:00
photonstorm
780fb48ab3 P2.World has a new contactMaterial property, which can be configured like a normal P2 Contact Material and is applied when two bodies hit that don't have defined materials. 2014-04-10 14:51:20 +01:00
photonstorm
8449f77152 Fixed World.restitution typo.
Updated World to use the new p2 defaultContactMaterial.
2014-04-10 14:41:50 +01:00
photonstorm
8bb22551aa Added jsdocs to Particle and Emitter. Fixed p2 UMD. 2014-04-10 01:48:55 +01:00
photonstorm
8fc2a465cd New Phaser package, small docs updates and preparing P2.World for new bounds code and v0.5.0 migration. 2014-04-08 03:31:13 +01:00
photonstorm
451f68be96 Updated p2 to 6abc900ff9 (which has probably broken stuff, but we'll test it tomorrow). 2014-04-08 03:30:45 +01:00
photonstorm
01eec6cef5 Keyboard.stop nulls the function references after removing the event listeners (thanks @bmceldowney, #691) 2014-04-07 12:29:26 +01:00
photonstorm
439cefd481 ArcadePhysics.Body.hitTest(x, y) will return a boolean based on if the given world coordinate are within the Body or not.
Fixed jsdoc method tags in Body.
2014-04-01 03:54:20 +01:00
photonstorm
9762bff5eb Updated docs to specify callback parameter order (#667) 2014-04-01 00:50:24 +01:00
Georgios Kaleadis
0a456d81c1 remove physics loader flags in p2 world, fix naming in loader 2014-03-31 10:46:17 +03:00
Georgios Kaleadis
d2a348f0bb return the result of body#setCircle 2014-03-28 09:48:23 +02:00
photonstorm
5b73bb21bb Sprite would glitch if it had an ArcadePhysics Body that was re-positioned out of loop.
Sprite would "fly off" if it had an ArcadePhysics Body that was re-positioned during an input handler.
Newly generated docs
2014-03-28 01:42:49 +00:00
Richard Davey
2092a7e360 Merge pull request #653 from bmceldowney/dev
Removing tilemap layer retrieval for object layers in convertCollisionObjects()
2014-03-26 15:48:42 +00:00
Richard Davey
06c953a293 Merge pull request #647 from xtian/grunt-jshint
Run jshint as part of build process and fix jshint errors
2014-03-26 15:46:35 +00:00
Ben McEldowney
2cd538e498 removing erroneous tilemap layer retrieval for object layers in convertCollisionObjects() 2014-03-26 07:48:47 -07:00
photonstorm
fc0e239719 ArcadePhysics.Body preUpdate has been modified to stop Sprites with non-1 scaling from gaining delta and moving off the screen (fix #644).
Lots of ArcadePhysics.World methods have been marked as private where they shouldn't be called directly (separateX, etc)
2014-03-26 10:48:30 +00:00
Christian Wesselhoeft
f409a735f0 Fix jshint issues in src/Phaser.js 2014-03-25 14:56:05 -07:00
Christian Wesselhoeft
1c286c1ae5 Fix jshint issues in src/physics/p2 2014-03-25 14:56:05 -07:00
Christian Wesselhoeft
b375daa3f6 Fix jshint issues in src/physics/ninja 2014-03-25 14:56:05 -07:00
Christian Wesselhoeft
5f267baeb0 Fix jshint issues in src/physics/arcade 2014-03-25 14:56:04 -07:00
Christian Wesselhoeft
61f18b675c Trim trailing whitespace. 2014-03-25 14:56:04 -07:00
photonstorm
26a89f0b84 New build files with tilemap callback fixes in. 2014-03-24 01:39:09 +00:00
Georgios Kaleadis
c2964857a3 multiple circle shapes in a body with position 2014-03-21 20:45:25 +01:00
Richard Davey
51a2002bf8 Merge pull request #622 from georgiee/fix-prismatic-naming
Fixed bug in prismatic joint. Lock flag not inverted, updated naming & description
2014-03-21 14:09:14 +00:00
photonstorm
0fca997d43 P2.Body.loadPolygon no longer modifies the Cache array (fix #613) 2014-03-21 13:46:35 +00:00
Georgios Kaleadis
c686ea0eb5 fixed naming for rotation lock in prismatic joint 2014-03-21 14:13:06 +01:00
Richard Davey
f0034008f5 Merge pull request #614 from georgiee/physics-phaser-exporter
Custom PhysicsEditor export & new p2 polygon parsing
2014-03-21 11:27:13 +00:00