Commit graph

873 commits

Author SHA1 Message Date
Aurélien DUSSAUGE
b14d920581 Replace DistanceBetween with DistanceSquared in closest() and furthest() functions (ArcadePhysics.js) 2018-08-13 21:59:58 +02:00
Richard Davey
4bdb0de312 The Arcade Physics Body.speed property is now set whenever you set the velocity via setVelocity or setVelocityX or setVelocityY which stops the body velocity being reset to zero if useDamping is enabled. Fix #3888 2018-08-08 17:31:22 +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
d50b72dd14 Fixed Group creation arguments 2018-08-01 18:01:36 +01:00
Richard Davey
3d23013b86 Body setSize changes to fix #3863 PR 2018-07-31 09:39:22 +01:00
Richard Davey
16234491f2
Merge pull request #3863 from tarsupin/patch-2
Empty params reset to current texture size
2018-07-31 09:31:05 +01:00
tarsupin
79d64abaa3
Add spaces after ifs 2018-07-24 20:06:18 -05:00
tarsupin
2e72c9966b
Reset body to match current frame
When using setSize, empty height and width will automatically assign to match the current frame of the game object.
2018-07-24 20:05:51 -05:00
tarsupin
7af6e5477f
Empty params reset to current texture size
If the width and height aren't provided, it resets the body's size to match the current frame of the game object's texture.
2018-07-24 19:53:41 -05:00
samme
7ebc7dd01f Fix ArcadePhysics#closest, furthest 2018-07-18 16:23:38 -07:00
Richard Davey
7aa46657c2 Tidying up jsdocs and changing float to number 2018-06-26 23:19:14 +01:00
samme
b3ac91df5a Fix blocked.none after separation 2018-06-19 14:48:07 -07: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
Richard Davey
9a53daa068
Merge pull request #3729 from CodeAndWeb/matterjs-pe-loader
Matterjs pe loader
2018-06-12 11:54:18 +01:00
Joachim Grill
ff7f614a8e renamed to PhysicsEditorParser, added jsdocs 2018-06-11 16:37:32 +02:00
Richard Davey
1777c47a23 Added missing check 2018-06-08 00:22:58 +01: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
Richard Davey
15af7c6d0c Added jsdocs 2018-06-04 01:38:45 +01:00
Richard Davey
e7fec396e1 If a Body collides with a Static Body it will now set the blocked properties accordingly 2018-06-03 21:17:33 +01:00
Richard Davey
579c6ba607 Body.useDamping is a new boolean property that allows you to use a damping effect for drag, rather than the default linear deceleration. 2018-06-03 17:08:08 +01:00
Richard Davey
9aa80b2b49 World.computeVelocity now uses the Body.useDamping property to perform either linear deceleration or damping on the Body.
updateMotion has been stream lined.
computeVelocity has been rewritten, takes new arguments, performs better internally.
2018-06-03 17:07:41 +01:00
Richard Davey
bbf6211107 Refactored enable and disable flow and added lots of jsdocs. 2018-06-02 12:45:25 +01:00
Richard Davey
9875318f20 Added missing dx/dy properties 2018-06-01 19:52:52 +01:00
Richard Davey
40a3896962 Added more jsdocs, setFPS and optimized group vs. sprite and RTree use 2018-06-01 19:19:07 +01:00
Richard Davey
586d1827e0 Removed dirty property, optimized update loop, refactored postUpdate for fixed time step 2018-06-01 19:18:40 +01:00
Richard Davey
329c9266b4 GetOverlapX/Y now use the calculated delta values, not the deltaX/Y methods 2018-06-01 15:41:40 +01: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
4ad7993b78 Added fixed timestep logic to Arcade Physics World 2018-06-01 03:25:33 +01:00
Richard Davey
652b7b04ba Huge new ArcadeColliderType def. Fix #3714. 2018-05-31 15:52:45 +01:00
Richard Davey
6ab124c591
Merge pull request #3687 from thomastanck/thomastanck-typedefupdates
Update type definitions
2018-05-24 13:49:30 +01:00
Richard Davey
68303622f2 Setting an existing Game Object as a static Arcade Physics body would sometimes incorrectly pick-up the dimensions of the object, such as with TileSprites. Fix #3690 2018-05-23 15:17:26 +01:00
Richard Davey
de8462efed Added default values and tidied up docs a little 2018-05-22 16:19:18 +01:00
Richard Davey
1485f34cbe
Merge pull request #3682 from samme/feature/arcade-body-setters
Add `allowDrag`, `allowGravity`, `allowRotation` to Arcade.PhysicsGroup config
2018-05-22 16:12:39 +01:00
Thomas Tan
0c61eb0062
Return type this for Arcade Physics components too 2018-05-22 16:09:28 +08:00
Thomas Tan
ff38588285
Specify type of ArcadeSprite.body
Do this by overwriting this.body in ArcadeSprite constructor.
2018-05-22 10:16:21 +08:00
Thomas Tan
8124ba9b86
Allow object param type for Arcade group Factory 2018-05-22 10:15:42 +08:00
Thomas Tan
806b5981b0
Add Group to param type in Arcade collide/overlap 2018-05-22 10:11:15 +08:00
Thomas Tan
3589b95bbd
Fix setCollideWorldBounds param type for Arcade 2018-05-22 10:05:37 +08:00
samme
24efda7aca Add allowDrag, allowGravity, allowRotation to PhysicsGroup config 2018-05-16 10:36:23 -07:00
samme
06677c2cdc Allow empty object2 in collideObjects 2018-05-15 13:11:31 -07: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
samme
a70fb6aee9 Add docs for Arcade Physics 2018-05-09 21:28:52 -07:00
Bill Reed
a996bbf8df
update collider and overlap param types 2018-04-30 08:44:02 -04:00
Bill Reed
3fc0712451
update collider param types 2018-04-30 08:43:21 -04:00
Bill Reed
e3af569642
update overlap and collide params 2018-04-30 08:42:49 -04:00
Bill Reed
7251824b1d arcade colliders take gameobjects, not arcade bodies 2018-04-30 07:46:46 -04:00
Bill Reed
a50b302216 same for overlap 2018-04-29 11:35:19 -04:00
Bill Reed
b483fc4e1a update arcade collider factory method optional params to match arcade world collider optional params 2018-04-29 11:33:01 -04:00
Richard Davey
349a95bc4b Updating to 3.6.0 2018-04-19 14:45:45 +01:00
Richard Davey
f57ab02fe6 Recoded how RTree generations its functions. Solves perf issue introduced in 3.4 Fix #3594 2018-04-18 22:32:52 +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
28e2764723 More jsdoc fixes 2018-04-16 16:02:27 +01:00
Richard Davey
b392dee5a9 More jsdoc fixes 2018-04-16 15:11:51 +01:00
Richard Davey
18585de81d Lots of jsdoc fixes 2018-04-16 14:43:24 +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
Richard Davey
64b07c6ecb eslint fix 2018-04-11 16:58:25 +01:00
Richard Davey
53425bdae9 Matter Image and Matter Sprite didn't define a destroy method, causing an error when trying to destroy the parent Game Object. Fix #3516 2018-04-11 14:35:18 +01:00
Richard Davey
70c7732a1e When shutting down a Matter World it will now call MatterEvents.off, clearing all events, and also removeAllListeners for any local events. 2018-04-11 14:00:58 +01:00
Richard Davey
011e67d0f0 The Matter SetBody Component will no longer try to call setOrigin unless the Game Object has the origin component (which not all do, like Graphics and Container) 2018-04-11 13:47:22 +01:00
Richard Davey
30d73a0197 Container can now be assigned an arcade physics body 2018-04-11 13:37:38 +01:00
Richard Davey
f80db91429 Allowing to work with Containers 2018-04-11 13:17:53 +01:00
Richard Davey
7aae84a790 Calling Impact.World.remove(body) during a Body.updateCallback would cause the internal loop to crash when trying to access a now missing body. Two extra checks are in place to avoid this 2018-04-11 10:39:20 +01:00
Joe Janiga
8ee9805596 work in progress on Static Body offset functionality... should Sprite.setPosition(x,y) effect Sprites static body? 2018-04-11 00:16:08 -04:00
Richard Davey
4466f28e44 Updated log 2018-04-05 08:48:35 +01:00
Richard Davey
d93e8ab919 Make sure debug layer remains on the top 2018-04-03 15:30:46 +01:00
Richard Davey
8ffe3e3aaf Small formatting fixes 2018-04-03 15:28:51 +01:00
Richard Davey
7f1723ca4f
Merge pull request #3458 from OmarShehata/master
Added joint debug rendering to Matter Physics postUpdate
2018-04-03 15:22:49 +01:00
Richard Davey
89c963c19c Ignore consts 2018-03-30 14:38:58 +01:00
Richard Davey
0868d69fb6 Added memberOf 2018-03-30 14:24:18 +01:00
Richard Davey
2d6251a1e9 Swapping to enums 2018-03-29 16:42:20 +01:00
Omar Shehata
b18530741d Replaced all uses of 'let' with 'var' to support older browsers 2018-03-29 08:53:38 -05:00
Richard Davey
cef9050627 jsdoc fixes 2018-03-29 14:53:06 +01:00
Richard Davey
d5fd3e20d9 Renamed namespace 2018-03-29 14:24:51 +01:00
Richard Davey
ce75947dac Swap to module 2018-03-29 14:02:25 +01:00
Richard Davey
e7191e9d8e jsdoc updates 2018-03-29 13:48:14 +01:00
Richard Davey
f5373b2dee jsdoc fixes 2018-03-29 13:23:44 +01:00
Richard Davey
f1e646c9ee jsdoc fixes 2018-03-28 15:39:57 +01:00
Richard Davey
747f09af86 jsdoc fixes 2018-03-28 15:04:09 +01:00
Richard Davey
2096729095 Missing require 2018-03-28 14:15:32 +01:00
Richard Davey
15c4334dc7 jsdoc fixes 2018-03-28 14:11:46 +01:00
Richard Davey
e7a1e3190a Matter Physics timestep adjustments (getDelta, step, set60Hz, etc)
* Matter Physics now has a new config property `getDelta` which allows you to specify your own function to calculate the delta value given to the Matter Engine when it updates.
* Matter Physics has two new methods: `set60Hz` and `set30Hz` which will set an Engine update rate of 60Hz and 30Hz respectively. 60Hz being the default.
* Matter Physics has a new config and run-time property `autoUpdate`, which defaults to `true`. When enabled the Matter Engine will update in sync with the game step (set by Request Animation Frame). The delta value given to Matter is now controlled by the `getDelta` function.
* Matter Physics has a new method `step` which manually advances the physics simulation by one iteration, using whatever delta and correction values you pass in to it. When used in combination with `autoUpdate=false` you can now explicitly control the update frequency of the physics simulation and unbind it from the game step.
2018-03-27 15:15:05 +01:00
Omar Shehata
4fa109d2db Added joint debug rendering to Matter Physics postUpdate 2018-03-25 22:44:32 -05:00
orblazer
f42f1bf132 Change structs for generic types 2018-03-23 16:54:12 +01:00
Richard Davey
574221d6cf A new property was added to Matter.World, correction which is used in the Engine.update call and allows you to adjust the time being passed to the simulation. The default value is 1 to remain consistent with previous releases. 2018-03-23 02:19:18 +00:00
Richard Davey
d78a9d097f eslint fixes 2018-03-22 13:22:23 +00:00
orblazer
ed1f2a7011 Fix wrong types 2018-03-22 13:51:30 +01:00
Richard Davey
32d9b82f93 Spacing 2018-03-21 17:22:09 +00:00
Richard Davey
0ef92e1172 Merge branch 'pr/3439' 2018-03-21 16:06:56 +00:00
Richard Davey
c6fc61e470 Fixed class names 2018-03-21 14:41:45 +00:00
Richard Davey
72690734c3 Fixed exposure 2018-03-21 14:41:34 +00:00
orblazer
11845f9d6d Fix "object" types on Physics and Math 2018-03-21 14:15:25 +01:00
Richard Davey
db613c793a Merge branch 'master' of https://github.com/photonstorm/phaser 2018-03-21 03:17:00 +00:00
Richard Davey
2f86100f87 MatterGameObject is a new function, available via the Matter Factory in this.matter.add.gameObject, that will inject a Matter JS Body into any Game Object, such as a Text object. 2018-03-21 03:16:36 +00:00
Richard Davey
5cae6d38b3 Matter.SetBody and SetExistingBody will now set the origin of the Game Object to be the Matter JS sprite.xOffset and yOffset values, which will auto-center the Game Object to the origin of the body, regardless of shape. 2018-03-21 03:16:01 +00:00
orblazer
7fba122321 Fix "any" types 2018-03-20 17:15:49 +01:00
orblazer
dca7996179 Fix multiple types on Physics, Texture and Input 2018-03-20 16:10:19 +01:00
orblazer
4cff464555 Fix nullable types 2018-03-20 15:36:03 +01:00
orblazer
fa13b597e3 Add more callbacks 2018-03-19 23:08:05 +01:00
orblazer
f30218d3d3 Add callbacks on Physics 2018-03-19 21:42:07 +01:00
Richard Davey
19a08286c0 More types added 2018-03-19 15:01:14 +00:00
Richard Davey
620bcc6ae5 jsdoc fixes and additions 2018-03-19 13:45:00 +00:00
orblazer
ae15eca7bd Update JSDoc on "Matter.JS" physics 2018-03-19 01:10:32 +01:00
orblazer
2da6a2bffe Update JSDoc on "Impact" physics 2018-03-19 00:42:09 +01:00
orblazer
af3c03a3cb Update JSDoc on "Arcade" physics 2018-03-19 00:29:46 +01:00
Richard Davey
edeb63ebbd eslint fix 2018-03-18 14:21:53 +00:00
Richard Davey
3d4be64331 Testing MatterGameObject 2018-03-17 18:07:05 +00:00
Richard Davey
05a4385cd7 jsdoc fixes 2018-03-16 17:29:39 +00:00
Richard Davey
a524dc44b0 Expose constants. Fix #3387 2018-03-16 13:29:30 +00:00
Richard Davey
7a8e4cf5e1
Merge pull request #3366 from samme/feature/world-wrap
Add Arcade.World wrap methods and Actions.WrapInRectangle
2018-03-16 12:58:16 +00:00
Sean Bohan
4cde28fecd Forgot to devide width by 2 2018-03-16 14:02:41 +08:00
Sean Bohan
72e82ecf48 Fix debug draw of scaled arcade body 2018-03-16 14:02:41 +08:00
samme
4b25574d82 Expect v3.3.0 2018-03-12 07:29:49 -07:00
samme
66e5a72dae Add Phaser.Physics.Arcade.World#wrap and friends
- Phaser.Physics.Arcade.World#wrap
- Phaser.Physics.Arcade.World#wrapArray
- Phaser.Physics.Arcade.World#wrapObject
2018-03-10 13:36:18 -08:00
Samid\Sami
f5e471dad7 removed trailing space for JSHint validation. 2018-03-08 11:46:01 +01:00
Samid\Sami
84481da4d1 * Fix #3345 by adding beginPath and closePath when done drawing in postUpdate. 2018-03-08 11:16:04 +01:00
Patrick Galbraith
8eb82e4fcb
Fix for collideGroupVsSelf is undefined
This happens when you call collide with a single group as the first param.

Seems like the `collideGroupVsSelf` function was not implemented. I've changed it to just call the `collideGroupVsGroup` with the first object twice which worked when I tested it on my project.
2018-03-05 21:15:38 +10:30
Sean Bohan
3f2e63fc17 Fix arcade body does not align with scaled parent object.
When a game object scaled, arcade body still calculate its position based on its original size instead of scaled one.
2018-03-01 09:02:04 +08:00
Richard Davey
1cae348300
Merge pull request #3278 from nkholski/arcadeGroups
Groups arcade collision
2018-02-28 20:56:11 +00:00
Richard Davey
218b4e4a52
Merge pull request #3285 from samme/docs/onWorldBounds
Describe Arcade.Body#onWorldBounds
2018-02-28 20:48:31 +00:00
Richard Davey
921d7e317a Arcade Physics Bodies didn't apply the results of allowRotation to the parent Game Object. 2018-02-27 01:08:55 +00:00
samme
36d91e9955 Describe Arcade.Body#onWorldBounds 2018-02-26 11:27:57 -08:00
Niklas Berg
b87d71ab73 single out groups without physics 2018-02-24 08:44:38 +01:00
Niklas Berg
b9e4d15efb Groups arcade collisions 2018-02-23 23:49:12 +01:00
samme
64e5b4394a Fix 'static is a reserved word in strict mode' 2018-02-18 10:38:08 -08:00
Richard Davey
3c65121cb3 eslint fixes 2018-02-16 19:17:49 +00:00
Richard Davey
d23688c3e4 Added eslint fixes and overrides 2018-02-16 18:44:07 +00:00
Richard Davey
3f155bf8f3 World didn't import GetOverlapX or GetOverlapY, causing separateCircle to break. 2018-02-16 18:43:06 +00:00
Richard Davey
86f00eeb52 eslint fixes 2018-02-16 18:17:51 +00:00
Richard Davey
4e6df03512 Updated semver 2018-02-15 14:31:15 +00:00
Richard Davey
aa9cac4ba8 Added refreshBody method and jsdocs 2018-02-15 01:52:01 +00:00
Richard Davey
7df00ccb6f Removed un-used properties from the Static Body
Set un-used Vectors to use the Vec2 ZERO constant to save object creation.
Added setGameObject and updateFromGameObject methods.
2018-02-15 01:51:36 +00:00
Richard Davey
4cc7fed1dd Added World.pendingDestroy Set and process it during postUpdate. 2018-02-15 01:50:22 +00:00
Richard Davey
b36dd17430 Removed pendingDestroy and opted for easier Set iteration.
Updated Body.reset so it resets the Sprite as well, otherwise the Body remains stuck on the next update loop.
2018-02-15 01:49:55 +00:00
Richard Davey
e68329f763 Fixed version numbers 2018-02-14 19:55:00 +00:00
Richard Davey
24e8f7a119 Body.destroy is now flag based, cleared by the World.
Added pendingDestroy flag to handle body destruction within events or collider iterations.
2018-02-14 19:36:34 +00:00
Richard Davey
81d0a48c58 disableBody renamed disableGameObjectBody
disableBody now disables just a body object.
destroying a body sets its `pendingDestroy` flag, which is now cleared in the postUpdate method.
Group vs. Group collision has been implemented.
World.destroy properly clears down its Sets and RTrees.
2018-02-14 19:35:57 +00:00
Richard Davey
b7beea1d37 Impact bodies now remove themselves from the world when destroyed. 2018-02-14 19:34:21 +00:00