dxu / matter-collision-events Goto Github PK
View Code? Open in Web Editor NEWA Matter.js plugin for adding per-body collision events and event handlers.
License: MIT License
A Matter.js plugin for adding per-body collision events and event handlers.
License: MIT License
Getting error "Plugin.dependencies: matter-collision-events used by [email protected] could not be resolved."
I noticed a there was a previous suggestion to ignore error. I dont have access to the Body.onCollide function so I assume it is not working correctly.
I just updated this package to version 0.1.6 in my project and I get this error:
[Error] Error: Cannot find module 'Matter'
at Function.Module._resolveFilename (module.js:470:15)
at Function.Module._load (module.js:418:25)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at n (/Users/and_re/Projects/hax/node_modules/matter-collision-events/build/matter-collision-events.min.js:1:83)
at Object.<anonymous> (/Users/and_re/Projects/hax/node_modules/matter-collision-events/build/matter-collision-events.min.js:1:273)
at Module._compile (module.js:571:32)
at Module._extensions..js (module.js:580:10)
at Object.require.extensions.(anonymous function) [as .js] (/Users/and_re/Projects/hax/node_modules/babel-register/lib/node.js:152:7)
at Module.load (module.js:488:32)
Everything works fine with 0.1.5 so I think it's because of this commit: 53c2d24
If I create a Matter physics object, and add a collision event listener, the collision event gets fired for EVERY collision in the world, instead of just the one object that I added the listener to.
this.physicsBox = Matter.Bodies.rectangle(x, y, w, h, options)
Matter.Composite.add(world, this.physicsBox)
this.physicsBox.onCollide((pair) => {
console.log('Box got hit!', pair.bodyA.label, pair.bodyB.label) // this logs every collision in the world, even if this box is not part of it.
});
matter-js: (6)
"Plugin.use:"
"[email protected]"
"is for"
"matter-js@^0.12.0"
"but installed on"
"[email protected]."
info โ matter.js:4610
Hello, I've installed the plugin using: yarn add matter-collision-events.
Then I attempt to require/import the plugin, however Matter does not seem to recognize the plugin when imported.
I've tried the following:
import * as Matter from 'matter-js' import MatterCollision from 'matter-collision-events' Matter.use('matter-collision-events')
import * as Matter from 'matter-js' import MatterCollision from 'matter-collision-events' Matter.use(MatterCollision)
I've also tried importing as 'MatterCollisionEvents'.
I get the same error:
Plugin.dependencies: matter-collision-events used by [email protected] could not be resolved.
Let me know if I'm doing something wrong, thanks!
Forgive me if I'm just being a noob right now, but I downloaded your master branch, did npm install
in the directory and did the python -m SimpleHTTPServer 3000
command. When I visit http://localhost:3000 I get the following errors:
Can you update this library to be used with [email protected]?
Since matter-tools
is only used is the demo, it should be a devDependency.
Currently, when the matter-collision-events
package is installed it will pull along matter-tools
and all its dependencies. This is suboptimal because it results in a bigger node_modules
directory and some of matter-tools
dependencies take ages to get built cough node-sass
cough.
Also, the node-sass
that matter-tools
uses' build process fails with Node.js 12 at the moment, so matter-collision-events can't be used in a Node.js 12 environment. Of course this issue also needs to be addressed separately, but at least it would not impact matter-collision-events
users.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.