Commit graph

325 commits

Author SHA1 Message Date
Richard Davey
37b2fbd044 Removed calcOffset 2019-12-17 13:05:16 +00:00
Richard Davey
1a50665ce1 Function not triggering properly. Adding to Body directly. 2019-12-17 02:14:54 +00:00
Richard Davey
819a6b20ae Walking through Matter compare merge 2019-12-16 17:12:12 +00:00
Richard Davey
f9e5246af0 Refactored so ops are done when the engine udates, not when the dom updates 2019-12-13 19:41:47 +00:00
Richard Davey
87a8af35c5 Added in Matter Runner 2019-12-13 19:41:27 +00:00
Richard Davey
604531d70a Disable sync verts for now 2019-12-13 19:41:18 +00:00
Richard Davey
e117a679d2 Still fix sleeping 2019-12-13 01:16:54 +00:00
Richard Davey
63083882d3 MatterGameObject has a new optional boolean parameter addToWorld which lets you control if the Body should be added to the world or not. Useful for toggling off should you be merging pre-existing bodies with Game Objects. 2019-12-12 17:15:00 +00:00
Richard Davey
7ba6e9fe6b Added setCompositeRenderStyle method 2019-12-12 13:31:47 +00:00
Richard Davey
093557a6ea Removed worldConstraint changes 2019-12-12 13:31:36 +00:00
Richard Davey
03e67e2c50 Added docs and Body level syncVerts property 2019-12-12 12:41:11 +00:00
Richard Davey
01fa4d2c54 Fix handling of centerOfMass 2019-12-11 16:06:15 +00:00
Richard Davey
7a2c434ffc Remove deprecated code 2019-12-11 16:06:01 +00:00
Richard Davey
4032f87368 Fixed handling deeply nested bodies 2019-12-11 16:05:52 +00:00
Richard Davey
4b14e489af Added start of fromJSON 2019-12-11 15:01:05 +00:00
Richard Davey
69eec0add9 Fixed overlap method 2019-12-11 15:00:51 +00:00
Richard Davey
c267662259 Update World.js 2019-12-11 15:00:41 +00:00
Richard Davey
30750d1208 Update PhysicsEditorParser.js 2019-12-11 13:07:04 +00:00
Richard Davey
826431c7fa Tidying up 2019-12-11 13:06:07 +00:00
Richard Davey
19fc914a5b PhysicsEditorParser.parseVertices now uses Bodies.flagCoincidentParts to avoid duplicating code. 2019-12-11 13:05:58 +00:00
Richard Davey
f5908fee8f Matter.Bodies.flagCoincidentParts is a new function that will flags all internal edges (coincident parts) on an array of body parts. This was previously part of the fromVertices function, but has been made external for outside use. 2019-12-11 13:05:49 +00:00
Richard Davey
bf00d63cc6 Body.syncVerts is a new function that will re-sync the vert positions with the body position. Called if Engine.syncVerts is set (which is now the default) 2019-12-10 17:53:44 +00:00
Richard Davey
a910a27349 Engine.syncVerts is a new Engine config property that allows you to run a vert re-sync at the end of the Engine step. This can help massively if you find you've got verts drifting out of alignment with the body position when using pointer contraints, or high velocity environments. Uses the new Engine._bodiesSync function. 2019-12-10 17:52:37 +00:00
Richard Davey
444bdf116f Debug tweaks 2019-12-10 17:50:04 +00:00
Richard Davey
c6bfaa8e4a Vertices.calcOffset is a new function that calculates the vert body position offset, used for keeping data in sync. 2019-12-10 17:49:41 +00:00
Richard Davey
4f3a524114 Update World.js 2019-12-10 14:02:50 +00:00
Richard Davey
b7343f3424 Bumped Matter Plugin versions to avoid console logs from Common.info and Common.warn. 2019-12-10 14:02:10 +00:00
Richard Davey
56929fb8c6 Removed use of Common.indexOf (no need for it) 2019-12-10 12:07:03 +00:00
Richard Davey
118aa3a941 Format fix 2019-12-10 12:05:12 +00:00
Richard Davey
0e95c1ad19 Merged Body.setCentre 2019-12-10 12:03:27 +00:00
Richard Davey
dc127081eb Merged new pointAWorld and pointBWorld functions 2019-12-10 12:01:58 +00:00
Richard Davey
257c00228b Removed un-used _requireGlobal function 2019-12-10 12:01:42 +00:00
Richard Davey
f22c3ad17d New fromPath reg exp 2019-12-10 12:01:24 +00:00
Richard Davey
5b17e35a87 Format tidy-up 2019-12-10 12:01:14 +00:00
Richard Davey
7bdcb5a892 Temp bounds debug 2019-12-10 02:42:16 +00:00
Richard Davey
b92e8e9a60 Moved position update to earlier (was too soon) 2019-12-09 17:13:10 +00:00
Richard Davey
eb254f0c5c If the Matter.Body config doesn't contain a position property, it will now default to using Vertices.centre(body.vertices) as the position. In most cases, this is what you need, so it saves having to pass it in the config object. 2019-12-09 13:22:55 +00:00
Richard Davey
c9adc01111 The Matter.PhysicsEditorParser has been updated so it no longer needs to set the render offsets, and instead uses the center of mass values. 2019-12-09 12:52:05 +00:00
Richard Davey
8f67dad4a5 Matter.setExistingBody, which is called interally whenever a Body is set on a Game Object, now uses the new centerOffset values to ensure that the texture frame is correctly centered based on the center of mass, not the Body bounds, allowing for much more accurate body to texture mapping with complex multi-part compound bodies. 2019-12-09 12:51:26 +00:00
Richard Davey
53314ca435 The Matter.Mass.centerOfMass component property now returns the pre-calculated Body centerOfMass property, which is much more accurate than the previous bounds offset value. 2019-12-09 12:49:55 +00:00
Richard Davey
9f012ebf86 Matter.Transform.centerOffsetX is a new read-only property available on all Matter Game Objects that returns the horizontal offset between the center of the frame and the center of mass. This can be used to allow for accurately mapping texture centers to the body center. 2019-12-09 12:48:51 +00:00
Richard Davey
50b511e872 Matter.Body.centerOfMass is a new property added to the Matter Body object that retains the center of mass coordinates when the Body is first created. 2019-12-09 12:45:44 +00:00
Richard Davey
a123faafdc Added new intersects, overlap and collision filter methods. 2019-12-04 03:52:00 +00:00
Richard Davey
e7cac4ebe9 Removed old config values and now handles opacity properly 2019-12-04 03:14:06 +00:00
Richard Davey
aeb3d5af06 Removed old properties and added new ones 2019-12-04 03:13:44 +00:00
Richard Davey
22baba0749 Updated custom render properties 2019-12-04 03:13:02 +00:00
Richard Davey
59749ab519 Skip matching a body against itself 2019-12-04 03:12:46 +00:00
Richard Davey
9b8ce1b8e3 Adjust Resolver properties from matter config 2019-12-03 16:56:29 +00:00
Richard Davey
75e2f76f8f Update Collision.js 2019-12-03 16:56:16 +00:00
Richard Davey
76c81e19c3 Moved the render style methods to World and use them as part of the event proxy 2019-12-03 14:48:04 +00:00
Richard Davey
7d2f3b33b5 Added setBodyRenderStyle and setConstraintRenderStyle methods. 2019-12-03 14:06:32 +00:00
Richard Davey
c299b02542 Update MatterCollisionEvents.js 2019-12-03 14:06:15 +00:00
Richard Davey
9a0218b3da Fixed line style and updated parameter names. 2019-12-03 14:06:10 +00:00
Richard Davey
f050b148ec Rewrote plugin to tidy it up. 2019-12-03 10:43:35 +00:00
Richard Davey
e0ae756f0d Add the new collision events plugin. 2019-12-02 19:21:04 +00:00
Richard Davey
ca293d710f Proxy the add and remove events and better handle debug draw injection. 2019-12-02 19:20:54 +00:00
Richard Davey
bdbd74917a Added missing plugin configs. 2019-12-02 19:20:24 +00:00
Richard Davey
b38668eb5f Finished all the JSDocs, exposed all Matter modules and added the new point checking methods. 2019-12-02 19:20:13 +00:00
Richard Davey
d75fb5b918 Removed un-used render properties and added new ones 2019-12-02 19:19:42 +00:00
Richard Davey
c32368e03e Added the new ADD and REMOVE Matter World events 2019-12-02 19:19:21 +00:00
Richard Davey
b71d4059a7 100% JSDoc'd! 2019-12-02 15:07:44 +00:00
Richard Davey
4f8dd24df2 Handle legacy configs for now. 2019-11-28 16:19:03 +00:00
Richard Davey
2a4dadf3a7 Update MatterWorldConfig.js 2019-11-28 16:18:53 +00:00
Richard Davey
8a844fc4d3 Create MatterDebugConfig.js 2019-11-28 16:18:49 +00:00
Richard Davey
f126f28121 Split out the debug rendering process into single methods, so they can be called externally if required 2019-11-28 10:43:26 +00:00
Richard Davey
65008266d6 Fixed worldConstraint 2019-11-27 17:49:38 +00:00
Richard Davey
4a1b9691c8 Custom render values set? 2019-11-27 17:49:30 +00:00
Richard Davey
3d46304b6a Final new debug config added 2019-11-27 17:49:21 +00:00
Richard Davey
7b280e4fb2 Redoing debug config 2019-11-26 16:39:34 +00:00
Anatoly Rybalchenko
03810ecccf Set 'part.angle' in 'Body.update' into matter-js 2019-10-05 02:02:30 +03:00
Richard Davey
ddc1a136ce MatterPhysics.shutdown could try to access properties that may have been previously removed during the Game.destroy process, causing a console error. It now checks properties before removing events from them 2019-09-26 12:17:16 +01:00
Richard Davey
b5d9ba3891 Added namespace for TS 2019-08-07 12:47:51 +01:00
Richard Davey
0de2695b07 PhysicsEditorParser has now been exposed under the Phaser.Physics.Matter namespace, so you can call methods on it directly. 2019-07-26 18:15:26 +01:00
Richard Davey
bb29aed88a Matter.Factory.constraint wouldn't allow a zero length constraint to be created due to a falsey check of the length argument. You can now set length to be any value, including zero, or leave it undefined to have it automatically calculated 2019-06-22 11:19:56 +01:00
Richard Davey
558f6aea55 JSDoc fixes 2019-06-04 16:01:37 +01:00
Richard Davey
17ad54b35b You can pass in a Body for a Matter Game Object to use 2019-06-01 10:53:05 +01:00
Richard Davey
63ead0cbc1 Added Matter.bodies 2019-05-31 19:42:49 +01:00
Richard Davey
09318530a4 Matter.Factory.fromVertices can now take a vertices path string as its vertexSets argument, as well as an array of vertices. 2019-05-29 14:50:57 +01:00
Richard Davey
d7af904bfa Added Matter velocity, angularVelocity and force methods 2019-05-21 14:23:32 +01:00
Richard Davey
478d6989c5 Expose the Matter.Body module 2019-05-20 17:13:05 +01:00
Richard Davey
c91ed91ce3 License link update 2019-05-10 16:15:04 +01:00
Richard Davey
a6341a97a8 Fixed Types references 2019-05-09 15:32:53 +01:00
Richard Davey
2008438919 Added new Matter World config def 2019-05-09 15:31:59 +01:00
Richard Davey
1531288301 Matter Types 2019-05-09 12:34:27 +01:00
Richard Davey
fda7772d3f Fixed jsdocs to flag arguments as optional. Fix #4506 2019-05-03 18:23:39 +01:00
Richard Davey
09487bbfc6 Added new resetCollisionIDs method re: #4334 2019-04-08 10:34:52 +01:00
Richard Davey
e017691c68 The ScaleMode Component has been removed from every Game Object, and along with it the scaleMode property and setScaleMode method. These did nothing anyway as they were not hooked to the render pipeline and scale mode should be set on the texture, not the Game Object. Fix #4413 2019-03-24 23:07:27 +00:00
Richard Davey
42cb39749f Matter and Snapshot typedefs 2019-02-13 15:22:29 +00:00
Richard Davey
b50e1c78b5 Lots more jsdoc tweaks and improvements 2019-02-12 15:01:54 +00:00
Richard Davey
ccaae460a4 Added jsdoc version numbers to each event 2019-02-12 11:37:58 +00:00
Richard Davey
62399a3aa5 Removed un-used package 2019-02-10 17:33:51 +00:00
Richard Davey
0ab61ac6de When the Matter World creates its wall bounds, the left and right walls now extend further up and down than before, so that in a 4-wall setting there are no gaps in the corners, which previously allowed for fast moving objects that hit a corner intersection point to sometimes travel through it. 2019-02-09 16:27:20 +00:00
Richard Davey
fd8d75ab02 Refactored the Pointer Constraint to make it work more like a real pointer does, added missing events, added full jsdocs. 2019-02-09 16:02:21 +00:00
Richard Davey
7041601893 Added drag events to Pointer Constraint 2019-02-09 14:58:42 +00:00
Richard Davey
bb83f4803e Testing Pointer events. 2019-02-08 19:46:23 +00:00
Richard Davey
5f03d2cd5e Testing Composite.remove, instead of removeBody. 2019-02-08 19:46:13 +00:00
Richard Davey
60542a25cc Numerous jsdoc and TS related fixes 2019-02-04 17:16:08 +00:00
Richard Davey
4f6f6ee72f Lots of jsdoc and type fixes 2019-01-31 12:19:01 +00:00
Richard Davey
bc962c25dc All listeners use the new Events 2019-01-18 13:41:43 +00:00
Richard Davey
8b35743943 Matter Events added 2019-01-17 15:47:27 +00:00
Richard Davey
aa341854c7 Happy New Year 2019-01-15 16:20:22 +00:00
Richard Davey
49c2868746 All default width/height values are now taken from the Scale Manager, not the Game Config 2019-01-11 15:57:57 +00:00
Richard Davey
30dda882eb Matter.TileBody.setFromTileCollision no longer checks if the shape is concave or convex before modifying the vertices, as the update to the Matter.js lib in 3.12 stopped this from working with Tiled collision shapes. 2019-01-08 11:50:21 +00:00
Richard Davey
566df734a0 MatterSprite would set its type property to be Image. It now sets it to be Sprite as it should do. 2019-01-04 14:16:10 +00:00
Richard Davey
cc55ee73cf Changing scaleX or scaleY on a MatterImage or MatterSprite would cause the body scale to become distorted as the setters didn't use the correct factor when resetting the initial scale. Fix #4206 2018-12-12 12:07:16 +00:00
Richard Davey
2780babe10 Final Doc Jam merge 2018-12-03 15:16:23 +00:00
Richard Davey
956a0913b8 Added new jsdocs 2018-10-22 12:12:31 +01:00
Richard Davey
4c4421c47f Docjam merge 2018-10-19 12:32:43 +01:00
Richard Davey
4b1c762296 Updated @memberOf to @memberof 2018-10-10 10:49:13 +01:00
Richard Davey
a9063604dc Replace @readOnly with @readonly 2018-10-09 13:40:00 +01:00
Richard Davey
099489e26d Added missing class desc 2018-10-01 14:44:30 +01:00
Richard Davey
c237209bb8 Added new jsdocs 2018-09-28 12:19:21 +01:00
Richard Davey
534814adb0
Merge pull request #4065 from rgk/patch-4
Matter.js Force Component Docs
2018-09-28 11:03:34 +01:00
Richard Davey
9c5876ffb0 Skip conditional if fromVerts given. Correctly set parts reference. 2018-09-26 14:15:38 +01:00
Richard Davey
80f7539a41 Matter.verts, available via this.matter.verts from within a Scene, is a quick way of accessing the Matter Vertices functions. 2018-09-26 14:13:03 +01:00
Richard Davey
df7245e3c5 Added all of the new Matter debug rendering options 2018-09-26 14:12:20 +01:00
Richard Davey
eb09c35056 The poly-decomp library, as used by Matter.js, has been updated to 0.3.0. 2018-09-26 11:08:55 +01:00
Robert Kowalski
bf38ce9fd4
Revsions based on Comments
Updated, better?
2018-09-25 11:31:18 -04:00
Robert Kowalski
0020745544
Quick space. 2018-09-25 07:15:11 -04:00
Robert Kowalski
185b19787e
Matterjs Gravity Component Doc 2018-09-25 07:14:32 -04:00
Robert Kowalski
5d0d84fe55
Matter.js Force Component Docs
Checking if I did this well before I start jumping into multiple files.
2018-09-25 04:46:30 -04:00
Richard Davey
89b9f42f3e Adding jsdocs 2018-09-24 23:20:43 +01:00
Richard Davey
5fe6dbbe0c Added more jsdocs 2018-09-13 08:09:44 +01:00
jf908
4f5b43e0ed
Allow matter js bodies to render their debug graphics individually 2018-09-04 18:45:54 +01:00
Richard Davey
da64e41b2f Fixed Matter require call freaking out webpack 2018-08-22 15:54:00 +01:00
Richard Davey
65fb366ecd Matter updated to 0.14.2. Fix #3929 2018-08-22 14:01:35 +01:00
Richard Davey
a98b3c3b15 In Matter.js if you scaled a Body it would only scale correctly once, due to the way Matter handles scaling internally. We now automatically reset the Matter scale before applying the new value, which allows you to keep the Phaser and Matter object scales in sync. Fix #3785 #3951 2018-08-21 15:55:39 +01:00
Michael Hadley
7675615b70 Update matter copy with bug fix from liabru/matter-js@4e04043fe0 2018-08-05 21:29:49 -05:00
Richard Davey
7aa46657c2 Tidying up jsdocs and changing float to number 2018-06-26 23:19:14 +01:00
Richard Davey
7eac419d3c Fixed namespace 2018-06-12 16:52:57 +01:00
Richard Davey
c7c104bc2b Tidied up the formatting and jsdocs for Physics Editor parser 2018-06-12 13:07:19 +01:00
Joachim Grill
ff7f614a8e renamed to PhysicsEditorParser, added jsdocs 2018-06-11 16:37:32 +02:00
Andreas Loew
bcef469e1c Trivial change to trigger travis ci build.
The last build failed because of lint issues outside of our code.
2018-06-05 07:45:56 +02:00
Andreas Loew
fea754f1f9 Converted code to ES5 2018-06-04 22:44:36 +02:00
Joachim Grill
6c58bd9029 fixed lint issues 2018-06-04 11:12:02 +02:00
Joachim Grill
bc4186061c added getter for center of mass 2018-06-01 14:42:59 +02:00
Joachim Grill
4719694f33 matter-js physics: added loader for shapes created and exported with PhysicsEditor 2018-06-01 14:42:28 +02:00
Richard Davey
350cb037b7 All systems now register themselves with the new PluginCache 2018-05-15 12:51:50 +01:00
Richard Davey
be330e609e Moved PluginManager to new location 2018-05-10 17:14:33 +01:00
Richard Davey
b0544c73b8 jsdoc fixes 2018-04-18 13:29:22 +01:00
Richard Davey
1be486fab4 destroy only called once, no matter how many times the Scene restarts. Fix #3581 2018-04-17 12:25:45 +01:00
Richard Davey
07a55e5d1f Removed debug call and merged Scene Systems boot and start sequences. Fix #3579 2018-04-17 02:34:07 +01:00
Richard Davey
b392dee5a9 More jsdoc fixes 2018-04-16 15:11:51 +01:00
Richard Davey
ce7d67297f Moving from 3.4.1 to 3.5.0 so we can release new camera fx and scene transitions 2018-04-15 12:44:47 +01:00
Richard Davey
18a6cf8ad1 eslint fixes 2018-04-13 18:09:16 +01:00
Richard Davey
01d3b7d6dc Missed out the config 2018-04-13 17:44:06 +01:00
Richard Davey
3490b29082 Tidying up 2018-04-13 17:43:56 +01:00
Richard Davey
be29c69a8c Disable pointer constraint debug by default 2018-04-13 17:43:44 +01:00
Richard Davey
6b2307594a Scene plugin flow overhaul
Every Plugin has been updated to correctly follow the same flow through the Scene lifecycle. Instead of listening for the Scene 'boot' event, which is only dispatched once (when the Scene is first created), they will now listen for the Scene 'start' event, which occurs every time the Scene is started. All plugins now consistently follow the same Shutdown and Destroy patterns too, meaning they tidy-up after themselves on a shutdown, not just a destroy. Overall, this change means that there should be less issues when returning to previously closed Scenes, as the plugins will restart themselves properly.
2018-04-13 17:12:17 +01:00
Richard Davey
8afa6c9c7f MatterEvents.off() would cause a TypeError if you destroyed the Matter world. Fix #3562 2018-04-13 12:07:27 +01:00