Giter Club home page Giter Club logo

verlet-js's People

Contributors

dominictarr avatar gfx avatar james2doyle avatar subprotocol 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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

verlet-js's Issues

Collisions with boundaries should stop at interesection point

Currently, the bounds are handled by forcing any particles outside of the bounds to be inside the bounds. However, since we're using verlet integration, this will result in an effective tangential acceleration (green vector) being applied to the body.

https://github.com/cwgreene/verlet-js/blob/master/images/error_type1.png?raw=true

This is visible by dragging the tire object in the demo to the left of the screen. Since the acceleration is applied downwards on the left hand side, the body rotates counter clockwise. When moved to the right hand side the acceleration will be applied upwards on the right hand side, again resulting in counter clockwise rotation.

I believe that by computing the intersection point (the origin of the green vector), and moving the particle there instead of the nearest bounding point (what is currently done), this issue will be resolved.

Please add user-select:none on the `<canvas>` element.

When you play with the mouse, you select the canvas.
Only tested on Canary 28 on Windows 7.

-webkit-user-select:none;
-moz-user-select:-moz-none;
-o-user-select:none;
-ms-user-select:none;
-khtml-user-select:none;
user-select:none;

Collision and Area Constraints

I don't know how dead this project is but I believe it has a lot of potential.

A lot is still broken. But I'm hoping that I could get some help and/or merge at some point.

Amoungst my problems are

  • Why are my collisions sliding into eachother?
  • How do I detect negative area?
  • When I get negative area, am I supposed to making the distances between the points smaller or attempt to switch sides?

Alot of my math is done on pen and paper and then applied to the engine. I can show as much as need be if you'd like to help. Some of it I've written inline for others to double check if need be.

Again: At some point I want to merge back to the main repository but of course that is only if you are willing. I've made many changes, some of which are breaking changes and to be honest more will be coming in the future.

Right now the breaking changes are

  • Vec2's are mutable by default. They require the person to create a copy with .clone() if they don't want them to be. This was done because of a delaunay algorithm I was initially using. Though I'm no longer using it, I wouldn't doubt I may do it again if it helps my blob.

Some other changes I may play with in the future

  • Make certian properties cached - this is mostly in my line, AABB, triangle and polygon. However it may be slower so I'm not 100% sure yet
  • store sorted lists of particles - Tests so far have told me its actually slower, however, it does not account for lists that have already been somewhat sorted. However, the sorted lists will almost only be used for calculating collisions so it might not be worth it
  • Breaking Change Make Constraints return a transform rather than directly changing velocity of the point
  • Breaking Change Use a math library to avoid floating point error as much as possible such as big number. This will cause many math calculations to be wrong unless you use the library
  • Change all for( a in array) to while(length--) and eventually .foreach() once chrome gets its act togethor- http://jsperf.com/for-vs-foreach/268
  • Look up more jsperf statistics such as vec2 as typed array or component
  • attempt to borrow algorithms from other blobs blobgame (box2d) and volume joint (@dmurph is a boss btws)

Ability to stop composites getting 'mashed' up?

Is there a way to stop a composite from getting mashed-up when you slam it against a wall with a lot of force? For example the particles can collapse on themselves and either seemingly vanish (from a visual point of view) or are combining on-top of themselves.

I've tried the new bounds check in the Pull Request but it happens for that also. I've tried setting stiffness to 1 but it doesn't seem to prevent it. Am I missing something obvious?

Also any pointers on how to handle collision between two composite objects?

Add it to bower

It would be great to submit this to bower.
Then it would be easer to integrate it in your own projects.

Is this 3D?

If not, do you know of a comparable 3D physics library?

open to a PR to de-crustify this?

@subprotocol would you accept a PR that makes this thing easier to run out-of-the-box? When I npm install and build things locally I get some errors and the examples are all non-functional.

Happy to simplify things and get the default state running again if you're open to that.

Mobile support?

Before I go gallivanting off to search for a CSS touch intercept parameter, is there already a common method of allowing verlet to work with mobile? Currently touches seem to scroll the entire page instead of manipulating the canvas.

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.