Comments (4)
Example use cases include:
- connecting the bodies/shapes from the physics engine with user defined information (like meshes, color, etc.)
- being able to select bodies with mouse
- being able to interact with certain bodies
- being able to detect collisions events (when a certain body has collided with another body)
- being able to query specific information from the engine, e.g. where is a certain body located now
from elm-physics.
-
connecting the bodies/shapes from the physics engine with user defined information (like meshes, color, etc.)
See the updated Spheres example.
-
being able to select bodies with mouse
Seems like this would need customized Ray/Shape collision detectors to calculate which shape if any has the closest collision along a ray ( a pair of Vec3's for world position and world normal ) projected "from the camera" through the clicked point on the view screen.
-
being able to interact with certain bodies
Any kind of meaningful interaction will involve replacing immutable bodies in a copied world (and possibly immutable shapes within copied bodies. It seems to make sense that these replacements would keep take over the ID associations of their originals, so any exposed IDs would remain valid.
We'd probably also want a means of deleting bodies from the world (MAYBE shapes from bodies, too, but this seems less useful) with a simultaneous purge of all external structures referencing their IDs. I'm imagining that in the long term we may want some kind of callback registry to support this.
-
being able to detect collisions events (when a certain body has collided with another body)
This seems like a variation of your code to expose all contacts (for diagnostic display) with added filtering for specific objects and possibly for new vs. previously reported/handled contacts. This MAY also be some kind of registered callback or event queuing done by the regular collision detection code.
-
being able to query specific information from the engine, e.g. where is a certain body located now
Mapping IDs back through the world to access current physics state and attributes seems not very difficult.
Maybe we should prioritize these and split them out as separate issues/tasks.
from elm-physics.
@paulmartel I think I've already mentioned this, but what do you think about only exposing body ids? The shapes can be pretransformed at the time of addition to a body. From the user point of view, meshes can be generated for the whole bodies, meaning less meshes and less WebGL draw calls.
from elm-physics.
I decided against id
in the new api #43, because ids make api very difficult. The Body data
approach lets users decide what they want as data
. This can be meshes https://github.com/w0rm/elm-physics/blob/master/examples/Common/Bodies.elm that really simplified the demo setup, or even ids if users wish to link external information.
from elm-physics.
Related Issues (20)
- Let user configure max step iterations
- Capsule shape support
- Body API additions for raycast vehicle simulation HOT 2
- Model state seems to miracliously change in the Dominoes Demo HOT 1
- Samples need other/more dependecies HOT 1
- The elm-package example source links are outdated (404) HOT 3
- Build a pluggable debugger for physics
- Body.map HOT 1
- Add the Particle (point mass) Shape type as supported in current.js.
- Add ray-body collision detection to enable future mouse support. HOT 1
- Add Physics.shapeFromVertices : Array Vec3 -> Result (Maybe Vec3, String) Shape HOT 2
- Task: benchmark convex/convex collisions. HOT 1
- Bug: spheres not behaving properly
- Does Physics.Constraint.pointToPoint constrain relative rotation? HOT 1
- Collision detection between a block and a sphere fails sometimes HOT 5
- Support a convex polyhedron shape HOT 1
- type of constraint that links two bodies, including rotation? HOT 2
- Improve moment of inertia calculation
- Introduce a way to bypass collisions
- Unexpected default behavior for Body HOT 2
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 elm-physics.