Coder Social home page Coder Social logo

matter-collision-events's People

Contributors

dxu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

matter-collision-events's Issues

Plugin is not resolving.

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.

Cannot find module 'Matter' in version 0.1.6

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

All collisions are triggered instead of just the one that has the event listener

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.
});

Unable to use via import/require

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!

  • Chris

matter-tools should be a devDependency

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.