{"_id":"cannon","_rev":"14-e20160f7c2e49459c7bdbea0be271b3a","name":"cannon","description":"A lightweight 3D physics engine written in JavaScript.","dist-tags":{"latest":"0.6.2"},"versions":{"0.4.0":{"name":"cannon","version":"0.4.0","description":"A lightweight 3D physics engine written in JavaScript. Perfect to use with three.js, for example.","homepage":"https://github.com/schteppe/cannon.js","author":{"name":"Stefan Hedman","email":"schteppe@gmail.com","url":"http://steffe.se"},"keywords":["cannon","physics","3d","cannon.js"],"main":"./build/cannon.js","engines":{"node":"*"},"repository":{"type":"git","url":"git://github.com/schteppe/cannon.js.git"},"bugs":{"url":"https://github.com/schteppe/cannon.js/issues"},"licenses":[{"type":"MIT"}],"devDependencies":{"jshint":"latest","uglify-js":"latest","nodeunit":"latest"},"dependencies":{"jshint":"*","uglify-js":"*","nodeunit":"*"},"_npmUser":{"name":"schteppe","email":"schteppe@gmail.com"},"_id":"cannon@0.4.0","optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.16","_nodeVersion":"v0.7.8-pre","_defaultsLoaded":true,"dist":{"shasum":"e2b494844e0c3a3892498d4c5f73c03cc12cee92","tarball":"https://registry.npmjs.org/cannon/-/cannon-0.4.0.tgz","integrity":"sha512-5rypt1q5Nt+2sTu9EoT9ZQBlB/WqrpOWoSOCvQkupdcZ2TnTnuFZAhTvDepx1d0q1Er1sl5ctOu6xPlEIVmQIw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCsVCElIrejY9i5LeztiGykuPe+KBOlu5VjfgQ87nL9nQIgGTs8DaZH4M55b80AGiJ2GpN5xFcTfp1YQQ/ZyDBwfwM="}]},"maintainers":[{"name":"schteppe","email":"schteppe@gmail.com"}]},"0.5.0":{"name":"cannon","version":"0.5.0","description":"A lightweight 3D physics engine written in JavaScript. Perfect to use with three.js, for example.","homepage":"https://github.com/schteppe/cannon.js","author":{"name":"Stefan Hedman","email":"schteppe@gmail.com","url":"http://steffe.se"},"keywords":["cannon.js","cannon","physics","engine","3d"],"main":"./build/cannon.js","engines":{"node":"*"},"repository":{"type":"git","url":"git://github.com/schteppe/cannon.js.git"},"bugs":{"url":"https://github.com/schteppe/cannon.js/issues"},"licenses":[{"type":"MIT"}],"devDependencies":{"jshint":"latest","uglify-js":"latest","nodeunit":"latest"},"dependencies":{},"_npmUser":{"name":"schteppe","email":"schteppe@gmail.com"},"_id":"cannon@0.5.0","optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.15","_nodeVersion":"v0.6.15","_defaultsLoaded":true,"dist":{"shasum":"2d3cda447ed67d4b4ca174a36978f8029fb97357","tarball":"https://registry.npmjs.org/cannon/-/cannon-0.5.0.tgz","integrity":"sha512-wbdmzOj7EeOgfL+/QduvE1tjKU4Hh8RH5uef1sBQpUK9T7SJYjNzFbYQFlWMcmZaU8xTjW6I7AmLTSRxLsHpMw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEsqrPtGrhBNVkmza+qJVaPwPqNMB8jF/O+abIhrc6hcAiAN4XXbFO4YUp9yYbaJJ4pwik2IZW1yVZyc1VFfqnTpwA=="}]},"maintainers":[{"name":"schteppe","email":"schteppe@gmail.com"}]},"0.6.0":{"name":"cannon","version":"0.6.0","description":"A lightweight 3D physics engine written in JavaScript.","homepage":"https://github.com/schteppe/cannon.js","author":{"name":"Stefan Hedman","email":"schteppe@gmail.com","url":"http://steffe.se"},"keywords":["cannon.js","cannon","physics","engine","3d"],"main":"./build/cannon.js","engines":{"node":"*"},"repository":{"type":"git","url":"https://github.com/schteppe/cannon.js.git"},"bugs":{"url":"https://github.com/schteppe/cannon.js/issues"},"licenses":[{"type":"MIT"}],"devDependencies":{"jshint":"latest","uglify-js":"latest","nodeunit":"^0.9.0","grunt":"~0.4.0","grunt-contrib-jshint":"~0.1.1","grunt-contrib-nodeunit":"^0.4.1","grunt-contrib-concat":"~0.1.3","grunt-contrib-uglify":"^0.5.1","grunt-browserify":"^2.1.4","grunt-contrib-yuidoc":"^0.5.2","browserify":"*"},"dependencies":{},"_id":"cannon@0.6.0","dist":{"shasum":"0b9b6b111e42e030a69b6260c65198f4d4689f8e","tarball":"https://registry.npmjs.org/cannon/-/cannon-0.6.0.tgz","integrity":"sha512-JVN00+h2pQ5q6hf4qxQxFy+aYlkgjjxszmxQdZnO/VaIsbklUqxNj1NeZ5zpzmzSXr9dFI/2E3XjDwliP23QAQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC4SrfPcdSspy/9Y+iyo3SsdRfl71I0fr1wtBW28F3S+gIhAKchKsKE+58EITHEWkuBMrvQZX3X8CxQ+fOayJpFemp4"}]},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"schteppe","email":"schteppe@gmail.com"},"maintainers":[{"name":"schteppe","email":"schteppe@gmail.com"}]},"0.6.1":{"name":"cannon","version":"0.6.1","description":"A lightweight 3D physics engine written in JavaScript.","homepage":"https://github.com/schteppe/cannon.js","author":{"name":"Stefan Hedman","email":"schteppe@gmail.com","url":"http://steffe.se"},"keywords":["cannon.js","cannon","physics","engine","3d"],"main":"./build/cannon.js","engines":{"node":"*"},"repository":{"type":"git","url":"https://github.com/schteppe/cannon.js.git"},"bugs":{"url":"https://github.com/schteppe/cannon.js/issues"},"licenses":[{"type":"MIT"}],"devDependencies":{"jshint":"latest","uglify-js":"latest","nodeunit":"^0.9.0","grunt":"~0.4.0","grunt-contrib-jshint":"~0.1.1","grunt-contrib-nodeunit":"^0.4.1","grunt-contrib-concat":"~0.1.3","grunt-contrib-uglify":"^0.5.1","grunt-browserify":"^2.1.4","grunt-contrib-yuidoc":"^0.5.2","browserify":"*"},"dependencies":{},"_id":"cannon@0.6.1","dist":{"shasum":"93b3d0dc63e913ec80d69512b2860486cefb5cde","tarball":"https://registry.npmjs.org/cannon/-/cannon-0.6.1.tgz","integrity":"sha512-sFFiDlk5PxaFlFJgCtPQwRulm80LFUqQvOOYq+M6pyzlJjTO/BTJliDHDvJLaaDi6aIuH7hQHDL9dl7QWQqffQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD1vwyYweBTTGBkTQ3KDuwKq+V2O+Cj6gs0IbZY+IjFKQIhAOdbf5eBt8TqpEpFPaMsx29lWH8kPznTUahK598pin9e"}]},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"schteppe","email":"schteppe@gmail.com"},"maintainers":[{"name":"schteppe","email":"schteppe@gmail.com"}]},"0.6.2":{"name":"cannon","version":"0.6.2","description":"A lightweight 3D physics engine written in JavaScript.","homepage":"https://github.com/schteppe/cannon.js","author":{"name":"Stefan Hedman","email":"schteppe@gmail.com","url":"http://steffe.se"},"keywords":["cannon.js","cannon","physics","engine","3d"],"main":"./build/cannon.js","engines":{"node":"*"},"repository":{"type":"git","url":"https://github.com/schteppe/cannon.js.git"},"bugs":{"url":"https://github.com/schteppe/cannon.js/issues"},"licenses":[{"type":"MIT"}],"devDependencies":{"jshint":"latest","uglify-js":"latest","nodeunit":"^0.9.0","grunt":"~0.4.0","grunt-contrib-jshint":"~0.1.1","grunt-contrib-nodeunit":"^0.4.1","grunt-contrib-concat":"~0.1.3","grunt-contrib-uglify":"^0.5.1","grunt-browserify":"^2.1.4","grunt-contrib-yuidoc":"^0.5.2","browserify":"*"},"dependencies":{},"_id":"cannon@0.6.2","dist":{"shasum":"1e7bc72dd5841982f3c104c2bc578bfa4fb1c572","tarball":"https://registry.npmjs.org/cannon/-/cannon-0.6.2.tgz","integrity":"sha512-n/7wWSXr8KOSvjad2x0fJHgpMepKjOKi+NdSnjfYyijoDBZnp4JQKgPcpv28jlXoWM+N9zVYU09J0A6Qxx+Y7w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDjvUCztpSgFby6zTL6I7RMY/2/groUblXFbU9puR1XeQIgMFU+fVQ59MLdy6gLqI5/UREWcEtcWjA4IUzCOTe1NNM="}]},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"schteppe","email":"schteppe@gmail.com"},"maintainers":[{"name":"schteppe","email":"schteppe@gmail.com"}]}},"readme":"# cannon.js\n\n### Lightweight 3D physics for the web\nInspired by [three.js](https://github.com/mrdoob/three.js) and [ammo.js](https://github.com/kripken/ammo.js), and driven by the fact that the web lacks a physics engine, here comes cannon.js.\nThe rigid body physics engine includes simple collision detection, various body shapes, contacts, friction and constraints.\n\n[Demos](http://schteppe.github.com/cannon.js) - [Documentation](http://schteppe.github.com/cannon.js/docs) - [Rendering hints](https://github.com/schteppe/cannon.js/tree/master/examples) - [NPM package](https://npmjs.org/package/cannon) - [CDN](https://cdnjs.com/libraries/cannon.js)\n\n### Browser install\n\nJust include [cannon.js](https://github.com/schteppe/cannon.js/releases/download/v0.6.1/cannon.js) or [cannon.min.js](https://github.com/schteppe/cannon.js/releases/download/v0.6.1/cannon.min.js) in your html and you're done:\n\n```html\n<script src=\"cannon.min.js\"></script>\n```\n\n### Node.js install\n\nInstall the cannon package via NPM:\n\n```bash\nnpm install --save cannon\n```\n\nAlternatively, point to the Github repo directly to get the very latest version:\n\n```bash\nnpm install --save schteppe/cannon.js\n```\n\n### Example\n\nThe sample code below creates a sphere on a plane, steps the simulation, and prints the sphere simulation to the console. Note that Cannon.js uses [SI units](http://en.wikipedia.org/wiki/International_System_of_Units) (metre, kilogram, second, etc.).\n\n```javascript\n// Setup our world\nvar world = new CANNON.World({\n   gravity: new CANNON.Vec3(0, 0, -9.82) // m/s²\n});\n\n// Create a sphere\nvar radius = 1; // m\nvar sphereBody = new CANNON.Body({\n   mass: 5, // kg\n   position: new CANNON.Vec3(0, 0, 10), // m\n   shape: new CANNON.Sphere(radius)\n});\nworld.addBody(sphereBody);\n\n// Create a plane\nvar groundBody = new CANNON.Body({\n    mass: 0 // mass == 0 makes the body static\n});\nvar groundShape = new CANNON.Plane();\ngroundBody.addShape(groundShape);\nworld.addBody(groundBody);\n\nvar fixedTimeStep = 1.0 / 60.0; // seconds\nvar maxSubSteps = 3;\n\n// Start the simulation loop\nvar lastTime;\n(function simloop(time){\n  requestAnimationFrame(simloop);\n  if(lastTime !== undefined){\n     var dt = (time - lastTime) / 1000;\n     world.step(fixedTimeStep, dt, maxSubSteps);\n  }\n  console.log(\"Sphere z position: \" + sphereBody.position.z);\n  lastTime = time;\n})();\n```\n\nIf you want to know how to use cannon.js with a rendering engine, for example Three.js, see the [Examples](examples).\n\n### Features\n* Rigid body dynamics\n* Discrete collision detection\n* Contacts, friction and restitution\n* Constraints\n   * PointToPoint (a.k.a. ball/socket joint)\n   * Distance\n   * Hinge (with optional motor)\n   * Lock\n   * ConeTwist\n* Gauss-Seidel constraint solver and an island split algorithm\n* Collision filters\n* Body sleeping\n* Experimental SPH / fluid support\n* Various shapes and collision algorithms (see table below)\n\n|             | [Sphere](http://schteppe.github.io/cannon.js/docs/classes/Sphere.html) | [Plane](http://schteppe.github.io/cannon.js/docs/classes/Plane.html) | [Box](http://schteppe.github.io/cannon.js/docs/classes/Box.html) | [Convex](http://schteppe.github.io/cannon.js/docs/classes/ConvexPolyhedron.html) | [Particle](http://schteppe.github.io/cannon.js/docs/classes/Particle.html) | [Heightfield](http://schteppe.github.io/cannon.js/docs/classes/Heightfield.html) | Trimesh |\n| :-----------|:------:|:-----:|:---:|:------:|:--------:|:-----------:|:-------:|\n| Sphere      | Yes    | Yes   | Yes | Yes    | Yes      | Yes         | Yes     |\n| Plane       | -      | -     | Yes | Yes    | Yes      | -           | Yes     |\n| Box         | -      | -     | Yes | Yes    | Yes      | Yes         | (todo)  |\n| Cylinder    | -      | -     | Yes | Yes    | Yes      | Yes         | (todo)  |\n| Convex      | -      | -     | -   | Yes    | Yes      | Yes         | (todo)  |\n| Particle    | -      | -     | -   | -      | -        | (todo)      | (todo)  |\n| Heightfield | -      | -     | -   | -      | -        | -           | (todo)  |\n| Trimesh     | -      | -     | -   | -      | -        | -           | -       |\n\n### Todo\nThe simpler todos are marked with ```@todo``` in the code. Github Issues can and should also be used for todos.\n\n### Help\nCreate an [issue](https://github.com/schteppe/cannon.js/issues) if you need help.\n","maintainers":[{"name":"schteppe","email":"schteppe@gmail.com"}],"time":{"modified":"2022-06-13T05:33:37.103Z","created":"2012-04-18T18:09:15.031Z","0.4.0":"2012-04-18T18:09:16.937Z","0.5.0":"2013-02-20T17:00:54.916Z","0.6.0":"2014-09-21T16:33:19.940Z","0.6.1":"2014-10-31T07:47:15.975Z","0.6.2":"2015-03-28T19:03:58.108Z"},"author":{"name":"Stefan Hedman","email":"schteppe@gmail.com","url":"http://steffe.se"},"repository":{"type":"git","url":"https://github.com/schteppe/cannon.js.git"},"homepage":"https://github.com/schteppe/cannon.js","keywords":["cannon.js","cannon","physics","engine","3d"],"bugs":{"url":"https://github.com/schteppe/cannon.js/issues"},"readmeFilename":"README.markdown","users":{"thr0wn":true,"cedware":true}}