Commit graph

933 commits

Author SHA1 Message Date
Richard Davey
9caadeb364 Lint fix. #4992 2020-10-02 09:49:39 +01:00
Richard Davey
c3c35322c4
Merge pull request #4992 from svipal/master
Preliminary PR for isometric support
2020-10-02 09:42:47 +01:00
samme
2223aebffb Don't update center before separation
Should be unnecessary now
2020-10-01 10:44:40 -07:00
samme
9a348409e3 Update center after separation 2020-10-01 10:42:30 -07:00
samme
e639bb73d8 Correct Arcade Body types
For TypeScript

Fixes #5328
2020-09-28 11:42:21 -07:00
Richard Davey
1d66284a22 Removed debug logs and finished JSDocs 2020-09-28 15:25:43 +01:00
Richard Davey
34be82a20c Added processX and processY methods 2020-09-28 15:25:28 +01:00
Richard Davey
4d484e2c0c Updated to handle face blocking and all possible checks 2020-09-28 13:07:32 +01:00
Richard Davey
731e661d56 No longer needed 2020-09-28 13:07:11 +01:00
Richard Davey
4785953368 Merge branch 'master' of https://github.com/photonstorm/phaser 2020-09-28 08:07:23 +01:00
Richard Davey
09c2a2d622 Testing new separation 2020-09-28 08:07:19 +01:00
Richard Davey
30b514fc58
Merge pull request #5326 from samme/fix/body-setOffset
Remove Arcade.Body#updateCenter() in Arcade.Body#setOffset()
2020-09-26 10:19:53 +01:00
samme
639a93583f Remove updateCenter() in setOffset() 2020-09-25 14:42:56 -07:00
samme
d0f6070e14 Docs: Arcade.Body#setOffset 2020-09-25 14:37:26 -07:00
samme
13c27064a8 Docs: Arcade.Body#reset
Only game object receives the passed coordinates
2020-09-25 14:19:12 -07:00
Richard Davey
bed716e382 X Separation working properly in all cases. Now to adjust Y. 2020-09-25 21:25:01 +01:00
Richard Davey
7630b8e28d Testing new Separation logic (Y done, X in progress) 2020-09-25 18:01:40 +01:00
Richard Davey
2bcf1f70be Testing new separation logic (incomplete atm) 2020-09-24 18:10:11 +01:00
Richard Davey
da78d3ee42 Tidy up docs 2020-09-24 18:10:00 +01:00
Richard Davey
69b8458bb8 Added new pushable component 2020-09-24 18:09:49 +01:00
Richard Davey
b64d63f60e When running an Arcade Physics overlap test against a StaticBody, it will no longer set the blocked states of the dynamic body. If you are doing a collision test, they will still be set, but they're skipped for overlap-only tests. Fix #4435 2020-09-24 11:04:56 +01:00
samme
426c9632c7 Set maxVelocity in PhysicsGroupConfig 2020-09-22 16:05:21 -07:00
Svipal
299f83c13d fixed conflicts 2020-09-19 10:56:05 +02:00
svipal
79fe9abc6e finished updating culling system 2020-09-18 17:16:52 +02:00
samme
2eb505c91d Docs: Arcade.Body#setCollideWorldBounds 2020-09-17 14:20:13 -07:00
samme
7aa8f02d8c Add onWorldBounds arg in setCollideWorldBounds() 2020-09-17 14:19:57 -07:00
samme
b0ce62e2d8
Docs: correct type for Body#customBoundsRectangle 2020-09-08 18:44:12 -07:00
Svipal
1994185d6f merged master 2020-09-08 22:17:04 +02:00
Richard Davey
5344d39498 Better Group docs. Fix #5011 2020-09-07 16:40:05 +01:00
samme
803c300ae4 Add ArcadeWorldConfig.fixedStep 2020-09-03 07:32:44 -07:00
Richard Davey
2980a416c9
Merge pull request #5278 from samme/fix/arcade-body-resetFlags
Reset flags when resetting an Arcade Body
2020-09-02 11:11:34 +01:00
Richard Davey
07865a5823 Final set of namespace changes. Fix #5062 2020-09-01 20:28:42 +01:00
samme
e194e9586f Add delta arg to WORLD_STEP event 2020-09-01 11:33:31 -07:00
Richard Davey
d2cc809fdb Exported functions to namespace 2020-09-01 18:56:01 +01:00
Richard Davey
4c353571ca Removed protected status 2020-09-01 17:44:07 +01:00
Richard Davey
84a867c2ac ArcadePhysics.disableUpdate is a new method that will prevent the Arcade Physics World update method from being called when the Scene updates. By disabling it, you're free to call the update method yourself, passing in your own delta and time values.
`ArcadePhysics.enableUpdate` is a new method that will make the Arcade Physics World update in time with the Scene update. This is the default, so only call this if you have specifically disabled it previously.
2020-09-01 17:42:38 +01:00
Richard Davey
d3778bb4bb ArcadeWorldConfig.customUpdate is a new boolean property you can set in the Arcade Physics config object, either in the Scene or in the Game Config. If true the World update will never be called, allowing you to call it yourself from your own component. Close #5190 2020-09-01 17:42:19 +01:00
samme
11c0520d36 Clear wasTouching when resetting body 2020-08-29 11:56:15 -07:00
samme
57ee895437 Reset flags during reset 2020-08-27 12:35:01 -07:00
Svipal
809d0b7495 merged master 2020-08-09 13:13:09 +02:00
Svipal
241d4193e8 let's try again 2020-08-09 12:33:52 +02:00
Svipal
b4a1473fea test 2020-08-09 12:13:29 +02:00
Richard Davey
8db2543e27
Merge pull request #5242 from samme/fix/collide-with-friction
Fix collisions for objects moved by friction
2020-08-03 10:27:01 +01:00
Richard Davey
08e346952a
Merge pull request #5234 from samme/patch-4
Docs: Phaser.Physics.Arcade.Group#defaults
2020-08-03 10:23:15 +01:00
Richard Davey
c9330fd469
Merge pull request #5241 from samme/docs/add-existing
Docs: generic return for add.existing()
2020-08-03 10:19:42 +01:00
samme
f653a51cc0 Docs: generic return for add.existing() 2020-07-29 12:19:09 -07:00
samme
7685067310
Docs: Phaser.Physics.Arcade.Group#defaults
#4171, #5153
2020-07-23 09:48:53 -07:00
Richard Davey
af1198dcf5 Arcade.Components.Size.setBodySize is a new method available on Arcade Physics Game Objects that allows you to set the body size. This replaces setSize which is now deprecated. Fix #4786 2020-07-13 14:34:23 +01:00
Richard Davey
dea68135fd Correct texture type. Fix #5199 2020-07-13 13:29:01 +01:00
Richard Davey
ab8ad19b1e
Merge pull request #5208 from samme/fix/arcade-physics-body-prev
Fix incorrect Arcade Body delta
2020-07-13 13:10:51 +01:00
Richard Davey
6bd24ded25
Merge pull request #5202 from samme/fix/arcade-physics-circular-collisions
separateCircle fixes
2020-07-13 13:07:39 +01:00
Richard Davey
853feea355
Merge pull request #5183 from samme/feature/body-updateFromGameObject
Add Arcade.Body#updateFromGameObject
2020-07-13 12:39:45 +01:00
Richard Davey
54841002eb
Merge pull request #5162 from samme/docs/arcade-physics-types
Add Arcade Physics types
2020-07-13 12:27:54 +01:00
Richard Davey
bafae8424d
Merge pull request #5153 from samme/fix/create-group-from-children
Fix problems passing `children` to created group
2020-07-13 12:15:26 +01:00
Richard Davey
7fa6d17e17
Merge pull request #5150 from samme/fix/static-body-from-scaled-sprite
Fix static body position from scaled sprite
2020-07-13 12:13:13 +01:00
Richard Davey
5b4423d6f3
Merge pull request #5135 from samme/feature/collide-use-static-tree
Always use static tree for collision checks
2020-07-13 12:03:18 +01:00
Richard Davey
2f48e5ee00
Merge pull request #5134 from samme/feature/arcade-physics-collisions-perf
Arcade Physics collisions optimizations
2020-07-13 12:02:38 +01:00
Richard Davey
b2a67754df
Merge pull request #5115 from samme/docs/body-drag-type
Correct docs corrections
2020-07-13 11:47:18 +01:00
samme
1c2e15ac98 Update _dx and _dy during friction movement 2020-07-07 15:44:56 -07:00
samme
807aeed20c Correct prev and prevFrame 2020-07-03 14:02:10 -07:00
samme
16e94d79eb separateCircle fixes 2020-06-27 09:24:23 -07:00
samme
fd3c682646 Add Arcade.Body#updateFromGameObject 2020-06-05 10:32:05 -07:00
samme
dd7976699d Docs: grammar 2020-06-01 09:57:36 -07:00
samme
c0b6027160 Add Arcade Physics types 2020-05-23 10:09:41 -07:00
samme
1ed0aaf8ba Fix position from scaled sprite 2020-05-11 10:38:48 -07:00
samme
fa2e76c18c Add missing config when passing children only 2020-05-11 10:24:01 -07:00
samme
6f3c0d2bb8 Don't discard config 2020-05-11 10:22:13 -07:00
samme
f374a4c045 Docs: Body descriptions
'boundary' is ambiguous, given the other bounds
2020-05-08 10:50:11 -07:00
samme
35672274bc Docs: Correct description in ArcadeWorldConfig 2020-05-08 10:46:08 -07:00
samme
928ac2c31c Docs for Phaser.Physics.Arcade.Body#facing 2020-05-06 10:26:27 -07:00
samme
b2eb6bfc43 Docs: Phaser.Physics.Arcade.World#useTree
Static bodies are always kept in an RTree
2020-05-05 15:32:49 -07:00
samme
62f0cf732a Always search the static tree 2020-05-05 10:47:21 -07:00
samme
d80e4f5824 Skip intersects check by argument 2020-05-04 22:06:24 -07:00
samme
992af0b15e Fast path for overlapOnly 2020-05-03 23:17:27 -07:00
samme
db8db69575 Correct type for Phaser.Physics.Arcade.Body#drag
Fixes #5100
2020-04-29 11:18:56 -07:00
Richard Davey
ba76f61109
Merge pull request #4995 from samme/fix/checkCollision-none-vs-tile
Fix checkCollision none for tile collisions; and optimizations
2020-04-27 12:32:40 +01:00
Richard Davey
625ca20a0e Fix lint error introduced by #4989 2020-04-27 12:02:30 +01:00
Richard Davey
c8e0f91083
Merge pull request #4989 from jjcapellan/syncToRender
New property Arcade.World.fixedStep
2020-04-27 12:01:24 +01:00
Richard Davey
70a4b9843e
Merge pull request #5038 from halilcakar/master
Update JSDocs for events
2020-04-27 11:51:40 +01:00
samme
c0e5f201cd Docs: Arcade Physics collisions 2020-04-23 10:50:33 -07:00
samme
a47408030b Docs: Phaser.Physics.Arcade.Components.Friction 2020-04-21 15:08:49 -07:00
samme
d17c004787 Docs: correct description for Arcade.Body#drag
Fixes #5100
2020-04-21 11:10:43 -07:00
Svipal
aae73c3cb8 fixed independent ttw calls in physics/arcade/World.js 2020-04-13 18:40:58 +02:00
samme
700d3b7316 Physics groups descriptions 2020-03-21 09:46:31 -07:00
halilcakar
43f26ad31f Update JSDocs for events 2020-03-10 11:11:43 +03:00
samme
68db7d086e Exit early for checkCollision.none on bodyB 2020-03-04 12:47:58 -08:00
jjcapellan
327748bbbf Refactoring syncToRender to fixedStep 2020-02-28 18:47:44 +01:00
samme
3c2fac2101 Exit early for checkCollision.none 2020-02-08 17:17:02 -08:00
samme
e100ce6593 checkCollision.none should prevent tile collisions 2020-02-08 17:15:02 -08:00
jjcapellan
7e4c08c270 Added new property syncToRender 2020-02-06 19:58:43 +01:00
Richard Davey
58d40fa9e0 Cache the vars 2020-02-04 23:56:50 +00:00
Richard Davey
1a493caa4b
Merge pull request #4970 from samme/fix/arcade-body-setSize-center
Fix centering in Body#setSize()
2020-02-04 11:26:17 +00:00
samme
7d5673a0c7 Fix wrong body dimensions from a scaled game object 2020-02-01 17:25:15 -08:00
samme
a312d03843 Docs for Phaser.Physics.Arcade.StaticBody
`offset` is read only
2020-02-01 16:30:25 -08:00
samme
c07c57f9f8 Correct center 2020-02-01 16:27:02 -08:00
samme
a13d623743 Correct dimensions from game object 2020-02-01 16:20:46 -08:00
samme
37c64dc0a9 Correct center in constructor 2020-02-01 16:19:10 -08:00
samme
34176becb5 Correct position in constructor 2020-02-01 16:18:52 -08:00
samme
bc39e70412 Fix centering Body in setSize() 2020-01-27 11:15:06 -08:00
Richard Davey
4a6b2087f7 Fixed internal callback handlers 2020-01-15 12:45:59 +00:00
Richard Davey
ff65e69cd1 Changed copyright date to 2020 2020-01-15 12:07:09 +00:00
Richard Davey
c3940e15c6 PhysicsGroup now uses the new internalCreateCallback and internalRemoveCallback to handle its body creation and destruction, allowing you to use your own createCallback and removeCallback as defined in the Group config. Fix #4420 #4657 #4822 2020-01-14 23:57:48 +00:00
Richard Davey
fb7f66838a Marked width/height as readonly and added docs. Fix #4806 2020-01-14 22:45:55 +00:00
Richard Davey
8b9819b8f7
Merge pull request #4949 from samme/fix/collideSpriteVsSprite
Check for disabled body in collideSpriteVsGroup()
2020-01-13 11:34:36 +00:00
Andrew Brampton
e42f227ec2
Update documentation and one import, to use the consistent name of Vector2.
There were examples that used Vec2, which wouldn't work. For example `An array of Point or Vector2 objects: [new Phaser.Math.Vec2(x1, y1), ...]` was not copy and pastable.
2020-01-11 06:46:25 -08:00
samme
eacb61e109 Check for disabled body in collideSpriteVsGroup() 2020-01-09 19:45:11 -08:00
samme
fa57f74b8f Docs for Arcade Physics 2019-12-12 08:14:53 -08:00
Richard Davey
7ae124ff6e Docs fix. 2019-12-09 08:57:24 +00:00
Richard Davey
44ff20d07e Added deltaXFinal and deltaYFinal methods. 2019-12-09 08:55:37 +00:00
Richard Davey
dc6b080091
Merge pull request #4874 from samme/feature/overlapCirc
Add ArcadePhysics#overlapCirc()
2019-11-20 22:02:15 +00:00
Richard Davey
e5421c4ebf Fixed namespace #4873 2019-11-20 22:00:17 +00:00
Richard Davey
ce2dbb7095
Merge pull request #4873 from samme/feature/group-type
Add `type` for Group, Arcade.Group, Arcade.StaticGroup
2019-11-20 21:54:10 +00:00
samme
b0f99db47d Add ArcadePhysics#overlapCirc() 2019-11-20 12:21:53 -08:00
samme
8585541e15 Add type for Group, PhysicsGroup, StaticPhysicsGroup 2019-11-20 11:53:38 -08:00
samme
e572921f38 Add targets argument to closest(), furthest()
And exclude `source` from targets
2019-11-13 09:56:37 -08:00
samme
c46ab84fd9 Use body center in closest, furthest 2019-11-04 16:11:38 -08:00
Richard Davey
3a8a1f7b05 Added the new customBoundsRectangle config properties 2019-10-02 16:03:52 +01:00
Richard Davey
f0ed52c033 Tidy-up the customBoundsRectangle changes 2019-10-02 16:03:36 +01:00
Richard Davey
4f4b69123e
Merge branch 'master' into arcade_body_custom_bounds 2019-10-02 15:41:49 +01:00
Richard Davey
2c5b552bd5 Formatting tweak 2019-10-01 13:29:05 +01:00
Richard Davey
b78dbd81ac Moved author block and fixed Body reset issue 2019-10-01 13:28:59 +01:00
Richard Davey
f16a16ba7d
Merge pull request #4729 from Gamefroot/arcade-physics-fps-fixes
Arcade physics fps fixes
2019-10-01 13:17:41 +01:00
Richard Davey
7584b9b17f
Merge pull request #4752 from funnisimo/separateCircle
FIX #4751 - Physics.Arcade.World.separateCircle - weird effects when …
2019-09-26 12:30:18 +01:00
Funnisimo
4455237967 need to do velocity based separation too 2019-09-19 14:13:07 -05:00
Funnisimo
b7ff2c02ae FIX #4751 - Physics.Arcade.World.separateCircle - weird effects when bounce=0 2019-09-13 11:34:11 -05:00
Funnisimo
4bffc5a341 updated for lint 2019-09-12 10:09:47 -05:00
Funnisimo
bfcfde52f9 FIX: #4748 Physics.Arcade.Body.hitTest - bug with circles 2019-09-12 10:02:01 -05:00
Richard Davey
5b10c07d2e ArcadePhysics.Body.checkWorldBounds would incorrectly report as being on the World bounds if the blocked.none flag had been toggled elsewhere in the Body. It now only sets if it toggles a new internal flag 2019-09-05 16:06:08 +01:00
Ben Richards
95d413dc3f Fix friction issues at low frame rates or repeated physics steps.
- Add `prevFrame` to hold previous frame positions (`prev` now holds
  previous step positions explicitly).
- Reset `prev` per step, fixing physics that relies on it.
- Remove `_reset` in favour of `moves`, which was all it ever checked.
  Ironically, `_reset` never reset itself.
- Remove some `postUpdate` property setting which is now unnecessary.
  The `prev` values now update just before they're used, so if you check
  them outside the physics step, they reflect the previous step.
- Reset `World#stepsLastFrame` per frame, so it won't get stuck on.
2019-08-29 10:06:10 +12:00
Ben Richards
fd0dd79417 Prevent objects from sinking into tilemaps at low frame rates.
Because `blocked` would be set by the first collision,
repeated steps would then skip it, and allow gravity or acceleration
to ignore tiles in that direction for those steps.
2019-08-29 10:06:10 +12:00
Richard Davey
6c575ca20e Arcade.Events.WORLD_STEP is a new event you can listen to. It is emitted by the Arcade Physics World every time the world steps once. It is emitted _after_ the bodies and colliders have been updated. Fix #4289 2019-06-19 15:41:45 +01:00
Richard Davey
ef4b3cfe89 Improved update handler to cut down on body iteration and stepping without an update due. Fix #4529 2019-06-19 15:32:17 +01:00
Richard Davey
96298cf920 Added new resetFlags method and willStep and delta arguments to preUpdate. 2019-06-19 15:31:29 +01:00
Richard Davey
b917a0611f ESLint fix 2019-06-19 09:46:38 +01:00
Richard Davey
57fd8c9ce1
Merge pull request #4540 from BdR76/patch-2
drawDebug, display checkCollision sides
2019-06-19 09:28:31 +01:00
Richard Davey
932583402c
Merge pull request #4589 from samme/x/arcade-static-body-setSize
Change arguments to Arcade.StaticBody#setSize
2019-06-19 09:21:00 +01:00
samme
7bba56be16 Change arguments to StaticBody#setSize
`center` replaces `offsetX`, `offsetY`
2019-06-12 10:59:07 -07:00
Richard Davey
9c7b26260e StaticPhysicsGroup can now take a classType property in its Group Config and will use the value of it, rather than override it. If none is provided it'll default to ArcadeSprite. Fix #4401 2019-06-12 12:06:40 +01:00
Richard Davey
77859b1cdf Calling Arcade Physics Body.reset on a Game Object that doesn't have any bounds, like a Container, would throw an error about being unable to access getTopLeft. If this is the case, it will now set the position to the given x/y values 2019-06-11 18:20:56 +01:00
Markus Appel
5ff9b20668
Correct docs of arcade physics body member 2019-06-09 12:22:15 +02:00
samme
6a2c476557 Use defaultStrokeWidth in drawDebug() 2019-06-04 13:27:02 -07:00
BdR76
717c89d79b
Changed if-statements to multiple lines
Changed the if-statements to multiple lines as per ESLint config
2019-05-31 13:15:23 +02:00
samme
8e717d5588 Remove GroupClassTypeConstructor type 2019-05-23 15:10:40 -07:00
BdR76
f28df06bcf
drawDebug, display checkCollision sides
drawDebug, instead of rectangle only draw the sides where checkCollision is true, similar to debugger in layer
2019-05-19 14:49:15 +02:00
hizzd
4aa3d9f81a
Fixed separateCircle cause the position set NaN. 2019-05-11 20:52:57 +08:00
Richard Davey
c91ed91ce3 License link update 2019-05-10 16:15:04 +01:00
Richard Davey
e8f6bae7cb A Body with damping and drag enabled would fail to move if it went from zero velocity to a new velocity inside an update loop. It will now reset its speed accordingly and retain its new velocity 2019-05-10 12:28:06 +01:00
Richard Davey
fbe2470f99 Arcade Physics Types 2019-05-09 12:33:37 +01:00
Richard Davey
e916dbe783 Math Types 2019-05-09 12:32:37 +01:00
Richard Davey
8e8b182359 Group Types 2019-05-09 11:56:16 +01:00