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
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