Comments (3)
hi thank's, no there is no event, i have to look best way to do that.
but ShapeConfig have a extra function i don't explaine: the collision filtering.
var sc = new OIMO.ShapeConfig();
var group1 = 1 << 0;
var group3 = 1 << 2;
var all = 0xffffffff;
sc.belongsTo = group1;
sc.collidesWith = all & group3;
i have to make demo on that
from oimo.js.
Oh... i will have to take a look at collidesWith then, thank you. Didn't saw it before.
For the record, while asking here, i was making a slightly modified Oimo.js version implementing some degree of a EventEmmiter pattern. I don't plan to publish that, it's just for my own use. But the strategy is simple: in World's constructor, after World instances CollisionDetectors, i set a reference to the world instance inside every detector instance, by using a simple loop. Then, in the detector code, when there's a collision, i add a call to one of the world reference's (also added by me) method: the "emit()" function.
So, calling world.emit("collision", pair) would trigger any event handler attached to the world for the "collision" event, and would take the pair of objects as parameter. And then it's just an application problem to properly set those event handlers as necessary.
It's kinda trivial to implement events that way, i just need to take the time to read and understand Oimo to know where to put the "emit" call and what to pass as parameter.
There are a few NPM packages for nodejs that gives a ready to use EventEmmiter class, in case you would like to take a look at it:
https://www.npmjs.org/package/event-emitter
https://www.npmjs.org/package/tiny-eventemitter
etc.
Cheers.
from oimo.js.
great i add new function to world you can see in test_moving.html
you can assign name to rigidBody and test if two name is on collision or not
world.checkContact('paddle', 'sphere') return true or false
only on dev version
from oimo.js.
Related Issues (20)
- Wrong Ineria of Cylinder about Y axis
- Contact callback HOT 2
- Differences between joint constraints.
- Documentation? HOT 3
- Importing convex mesh types to a world
- What design pattern is used by oimo.js? ECS mode? Component mode?
- Perpetuum mobile)
- TypeScript declarations HOT 3
- RigidBody_X? HOT 1
- d.ts file build failed
- support torus for oimo HOT 2
- Body names are duplicated. HOT 1
- Is it possible to move a Rigidbody without using force? HOT 1
- Want the update example about magnetic force
- How to move a ridgidbody without them bumping up over eachother HOT 1
- Exporting a mesh into a 3D file?
- Contact detection bugs with kinematic bodies
- Importing an .stl file in as a rigidbody.
- How to visualize a physic object in the scene?
- Impossible to "lock" a body after ?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from oimo.js.