Commit graph

933 commits

Author SHA1 Message Date
samme
995edbbe85 Add maxSpeed and useDamping to physics group config 2022-11-23 09:06:44 -08:00
Richard Davey
4bd64129e9 Only checkWorldBounds in Body.reset if the Body collides with it 2022-10-11 01:45:21 +01:00
Richard Davey
d68b0b7c91
Merge pull request #6155 from ef4/better-closest-type
Improve types for ArcdePhysics.closest
2022-10-10 14:50:36 +01:00
Richard Davey
023343c789 All events have a type of string. Fix #6136 2022-09-21 22:01:03 +01:00
samme
d40b084063 Destroy debugGraphic also 2022-08-18 17:25:32 -07:00
Richard Davey
13b6598558 The Physics.Arcade.Body.reset() method will now call Body.checkWorldBounds as part of the process, moving the body outside of the bounds, should you have positioned it so they overlap during the reset. Fix #5978 2022-07-28 18:35:56 +01:00
Richard Davey
c47a40ba97 Working through making Body a passable type 2022-07-04 18:44:10 +01:00
Richard Davey
ec8f20b692 Swap the handler type and fixed staticBody 2022-07-04 16:40:13 +01:00
Richard Davey
132ab9cdbd Added isBody property 2022-07-04 16:39:53 +01:00
Richard Davey
6b55ac6b06 Made gameObject optional 2022-07-04 15:55:14 +01:00
Richard Davey
284277887f Added body and staticBody methods 2022-07-04 15:55:07 +01:00
Richard Davey
20c597738f Made gameObject optional and added setGameObject method 2022-07-04 15:54:53 +01:00
Edward Faulkner
0791302699 Improve types for ArcdePhysics.closest
This uses generics so that the return type from closest() is narrowed to match whatever type you passed in for the eligible targets.

Resulting typescript diff:

```diff
--- a/types/phaser.d.ts
+++ b/types/phaser.d.ts
@@ -70565,7 +70565,7 @@ declare namespace Phaser {
                  * @param source Any object with public `x` and `y` properties, such as a Game Object or Geometry object.
                  * @param targets The targets.
                  */
-                closest(source: any, targets?: Phaser.Physics.Arcade.Body[] | Phaser.Physics.Arcade.StaticBody[] | Phaser.GameObjects.GameObject[]): Phaser.Physics.Arcade.Body | Phaser.Physics.Arcade.StaticBody | Phaser.GameObjects.GameObject;
+                closest<Target extends Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody|Phaser.GameObjects.GameObject>(source: Phaser.Types.Math.Vector2Like, targets?: Target[]): Target | null;

                 /**
                  * Finds the Body or Game Object farthest from a source point or object.
(END)
```
2022-06-25 17:00:02 -04:00
Richard Davey
4f005e3701 The Arcade Physics World.enableBody method will now only create and add a Body to an object if it has the Transform component, tested by checking the hasTransformComponent property. Without the Transform component, creating a Body would error with NaN values, causing the rest of the bodies in the world to fail. 2022-05-31 18:15:41 +01:00
Richard Davey
0e09776bd5 Added tileFilterOptions property 2022-05-26 18:54:55 +01:00
Richard Davey
aedf666ffc Testing filterOptions to avoid needless iterations 2022-05-25 21:01:30 +01:00
Richard Davey
c45caa86df JSDoc fix 2022-05-25 21:01:12 +01:00
Richard Davey
1020f72e4b Fixed type 2022-05-10 18:07:17 +01:00
Richard Davey
59fbcc5ca3 Updated copyright year 2022-02-28 14:29:51 +00:00
Richard Davey
7aa7187a0f
Merge pull request #5870 from samme/docs/class-types
Add GroupClassTypeConstructor and ParticleClassConstructor types
2022-02-28 13:53:39 +00:00
samme
3ab43f56f6 Revert "Skip intersects check by argument"
This reverts commit d80e4f5824.
2021-12-23 10:55:23 -08:00
samme
6dc89a4596 Docs: namespace ArcadePhysicsCallback 2021-11-21 20:23:31 -08:00
Richard Davey
950ba75bfc Updated jsdocs 2021-11-02 14:02:46 +00:00
samme
52e402e14e Docs: add Phaser.Types.GameObjects.Group.GroupClassTypeConstructor 2021-10-13 13:22:54 -07:00
Richard Davey
a4d8c9be47 Fix #5759 2021-09-28 15:21:13 +01:00
Richard Davey
d70b149170
Merge pull request #5793 from samme/fix/separate-tile-update-center
Update body center after tile separation
2021-09-22 11:01:28 +01:00
Richard Davey
f0eb694166
Merge pull request #5763 from samme/fix/group-double-collide
Do physics group vs. self collisions without the RTree
2021-09-21 11:44:52 +01:00
Richard Davey
2546096b64 Fixed JSDocs. Close #5836 2021-09-21 11:33:01 +01:00
samme
214a19fb7a Update body center after tile separation 2021-07-28 09:57:54 -07:00
samme
abfb8c6d7d Collide group vs self as array
Fixes #5758
2021-06-29 10:46:57 -07:00
Richard Davey
f001d6db2e
Merge pull request #5577 from samme/patch-6
Docs: damping in Phaser.Physics.Arcade.Body#drag
2021-03-01 16:39:47 +00:00
Richard Davey
d22e3567c7 Fixed a conditional bug in Arcade Physics ProcessX when Body2 is Immovable and Body1 is not 2021-02-25 14:40:34 +00:00
samme
ea7a9aa132
Docs: damping in Phaser.Physics.Arcade.Body#drag 2021-02-23 09:53:42 -08:00
Richard Davey
cbe1a3219a JSDoc improvements 2020-12-14 13:33:42 +00:00
Richard Davey
28d925b875 JSDoc fixes 2020-11-23 15:06:45 +00:00
Richard Davey
417f7684c3 More integer to number changes 2020-11-23 10:32:00 +00:00
Richard Davey
02c34cd64e Replace integer with number 2020-11-23 10:22:13 +00:00
Richard Davey
d397551b3d
Merge pull request #5391 from samme/fix/overlapR
Set Arcade.Body#overlapR in separateCircle()
2020-11-09 17:10:18 +00:00
Richard Davey
ca8f201e8a
Merge pull request #5388 from samme/feature/scale-damping
Scale damping by the physics step delta
2020-11-09 17:07:30 +00:00
Richard Davey
6c69cf3627
Merge pull request #5387 from samme/docs/static-body
Docs: StaticBody#touching etc.
2020-11-09 17:06:57 +00:00
Richard Davey
bbb397c860
Merge pull request #5350 from samme/feature/worldstep-event-delta
Add delta argument to WORLD_STEP event
2020-11-09 17:05:37 +00:00
samme
956f880fa4 Set overlapR in separateCircle() 2020-11-08 09:19:53 -08:00
samme
4185e661d7 Docs: banish StaticBody touching properties
Fixes #5381
2020-11-07 10:04:28 -08:00
samme
be558d2dca Scale damping 2020-10-22 13:59:49 -07:00
Richard Davey
675e43350d Physics.Arcade.Body.setDamping is a new method that allows you to set the useDamping property of a Body in a chainable way. Fix #5352 2020-10-16 17:57:26 +01:00
Richard Davey
8a01ae1cb7 Call the component directly to avoid lots of function diving 2020-10-15 11:47:24 +01:00
Richard Davey
8d2e7b08c5 Update World.js 2020-10-15 11:07:51 +01:00
Richard Davey
417e57c199 Update Collider.js 2020-10-15 11:07:27 +01:00
Richard Davey
00b8bb4e0f
Merge pull request #5344 from samme/fix/collisions-update-center
Correct Arcade Body center after separations
2020-10-06 09:45:41 +01:00
samme
130160f825 Update center after world bounds collision 2020-10-03 13:46:11 -07:00
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