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