Commit graph

1482 commits

Author SHA1 Message Date
Richard Davey
49e97291cf SetCollisionObject is a new function that Arcade Physics bodies use internally to create and reset their ArcadeBodyCollision data objects. 2023-10-04 12:46:58 +01:00
Richard Davey
b364995f2f Added Body.slideFactor vec2
* Arcade Physics Bodies have a new property called `slideFactor`. This is a Vector2 that controls how much velocity is retained by a Body after it has been pushed by another Body. The default value is 1, which means it retains all of its velocity. If set to zero, it will retain none of it. This allows you to create a Body that can be pushed around without imparting any velocity to it.
* `Body.setSlideFactor` is a new method that sets the Body's `slideFactor` property.
2023-10-04 11:57:37 +01:00
Richard Davey
563137ac78 Typo fix 2023-10-04 11:57:24 +01:00
Richard Davey
94662cdbc7 StaticBody.setSize will now check to see if the body has a Game Object or not, and only call getCenter and the frame sizes if it has. This fixes a bug where calling physics.add.staticBody would throw an error if you provided a width and height. Fix #6630 2023-09-27 18:22:01 +01:00
Richard Davey
a1bc5e247b Clarify set body docs further 2023-09-14 11:47:31 +01:00
samme
90799f39ed
Docs: StaticBody#reset description 2023-08-22 08:48:01 -07:00
Richard Davey
9080dbf1fd Updated documentation to explain about calling convertTiles 2023-08-15 23:37:05 +01:00
Richard Davey
c5d53f9e94 Fixed typo 2023-08-08 13:08:54 +01:00
Richard Davey
23cd25f482 PhysicsGroup will now set the classType and null the config when an array of single configuration objects is given in the constructor. Fix #6519 2023-07-21 18:13:37 +01:00
Richard Davey
f0c6bd63bd The Matter Physics ignoreGravity boolean is now checked during the Matter Engine internal functions, allowing this property to now work again. Fix #6473 2023-07-21 17:40:47 +01:00
Richard Davey
a504c78d44 Physics.Arcade.World.singleStep is a new method that will advance the Arcade Physics World simulation by exactly 1 step (thanks @monteiz) 2023-07-21 16:33:31 +01:00
Richard Davey
2a2b9181f8 Adding documentation 2023-04-12 03:58:49 +01:00
Richard Davey
69841028bb Matter.convertTilemapLayers had an edge-case which could create composite bodies unintentionally. If any tiles had multiple colliders and you were providing body creation options, the parts property in the options would be modified and then concatenated with any bodies created after it. This could mean that some tiles would be combined when they shouldn't be, and on large maps would eventually hang once the convex hull got too big / complex. It now runs a copy on the object before using it - fix #5977 2023-04-12 03:08:52 +01:00
Richard Davey
4e18d35098 Fixed doc types 2023-04-04 17:55:56 +01:00
Richard Davey
8adbb15c13 Added new Matter Body methods (velocity and speed) 2023-04-04 15:05:42 +01:00
Richard Davey
0a8f9a9f04 Fixed jsdoc types 2023-04-04 15:05:11 +01:00
Richard Davey
24c85af875 Upgrade to MatterJS v0.19 2023-04-03 22:01:39 +01:00
Richard Davey
b5f1b2b588 The MatterTileBody class, which is created when you convert a Tilemap into a Matter Physics world, will now check to see if the Tile has flipX or flipY set on it and rotate the body accordingly. Fix #5893 2023-03-22 17:45:18 +00:00
Richard Davey
881d62075f Remove console.logs. Fix #6420 2023-03-22 16:19:55 +00:00
Richard Davey
c8acb16fa7 Added { willReadFrequently } to every canvas context, no matter where it comes from 2023-03-09 17:30:04 +00:00
Richard Davey
aa3e1d17ce Updated documentation 2023-02-27 16:26:04 +00:00
Richard Davey
884a2f1fad Added Matter Walls type 2023-02-01 18:08:40 +00:00
Richard Davey
dae80ee845 Update MatterWorldConfig.js 2023-01-27 17:45:32 +00:00
samme
ca2cef5281 Set blocked.none in processX(), processY() 2023-01-22 10:30:42 -08:00
samme
5c5829867c Docs: Enable#enableBody() and Enable#disableBody()
- Optional args in enableBody()
- Descriptions
2023-01-11 10:00:01 -08:00
Richard Davey
468bf7821d Updated copyright year 2023-01-02 17:36:27 +00:00
Richard Davey
463b602608 Use getters 2022-12-27 16:56:05 +00:00
Bambosh
8038341c96 Compare maxSpeed with updated velocity 2022-12-24 15:26:13 +11:00
samme
09be12612b Docs: change "Constructor" types to function
- Phaser.Types.GameObjects.Group.GroupClassTypeConstructor
- Phaser.Types.GameObjects.Particles.ParticleClassConstructor
- Phaser.Types.Tilemaps.CreateFromObjectsClassTypeConstructor

Fixes #6318
2022-12-16 15:37:09 -08:00
Richard Davey
4b4473394c Debugging circle collision 2022-12-13 18:24:41 +00:00
Richard Davey
e2539824ec Update World.js 2022-12-13 13:41:17 +00:00
Richard Davey
c5c2d2b329 Fixing the separation of non-pushable circular bodies 2022-12-13 01:56:23 +00:00
samme
995edbbe85 Add maxSpeed and useDamping to physics group config 2022-11-23 09:06:44 -08:00
Richard Davey
2a8250ef60 Modified return types to 'this' 2022-11-03 16:03:51 +00: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