{"id":20430758,"url":"https://github.com/whitestormjs/physics-module-oimojs","last_synced_at":"2025-07-13T07:40:35.441Z","repository":{"id":126476005,"uuid":"81441194","full_name":"WhitestormJS/physics-module-oimojs","owner":"WhitestormJS","description":null,"archived":false,"fork":false,"pushed_at":"2017-02-09T17:44:31.000Z","size":453,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-15T17:32:53.000Z","etag":null,"topics":["physics"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/WhitestormJS.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-02-09T11:00:16.000Z","updated_at":"2017-06-01T16:03:57.000Z","dependencies_parsed_at":"2023-06-16T23:00:35.457Z","dependency_job_id":null,"html_url":"https://github.com/WhitestormJS/physics-module-oimojs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WhitestormJS%2Fphysics-module-oimojs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WhitestormJS%2Fphysics-module-oimojs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WhitestormJS%2Fphysics-module-oimojs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WhitestormJS%2Fphysics-module-oimojs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WhitestormJS","download_url":"https://codeload.github.com/WhitestormJS/physics-module-oimojs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241975135,"owners_count":20051428,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["physics"],"created_at":"2024-11-15T08:08:53.335Z","updated_at":"2025-03-05T05:43:15.157Z","avatar_url":"https://github.com/WhitestormJS.png","language":"JavaScript","readme":"# physics-module-ammonext [![NPM Version](https://img.shields.io/npm/v/physics-module-ammonext.svg?style=flat-square)](https://www.npmjs.com/package/physics-module-ammonext)\nPhysics module for Whitestorm.js [Beta]\n\n\u003e Go to [WhitestormJS/whitestorm.js](https://github.com/WhitestormJS/whitestorm.js)\n\n![physics module](http://i.imgur.com/ZdMhDwb.png)\n\n# Modules list\n\n## `new PHYSICS.WorldModule()`\n\n```javascript\nconst app = new WHS.App([\n  // ...\n  new PHYSICS.WorldModule({\n    gravity: new THREE.Vector3(0, -10, 0)\n  })\n]);\n\napp.start();\n```\n\n## `new PHYSICS.BoxModule()`\n\n```javascript\nconst box = new WHS.Box({\n  geometry: {\n    width: 2,\n    height: 2,\n    depth: 4\n  },\n  \n  modules: [\n    new PHYSICS.BoxModule({\n      mass: 10\n    })\n  ],\n  \n  material: new THREE.MeshBasicMaterial({color: 0xff0000})\n});\n\nbox.addTo(app);\n```\n\n![](http://i.imgur.com/v7hzbeS.png)\n\n## `new PHYSICS.SphereModule()`\n```javascript\nconst sphere = new WHS.Box({\n  geometry: {\n    radius: 3\n  },\n  \n  modules: [\n    new PHYSICS.SphereModule({\n      mass: 10\n    })\n  ],\n  \n  material: new THREE.MeshBasicMaterial({color: 0xff0000})\n});\n\nsphere.addTo(app);\n```\n\n![](http://i.imgur.com/GgqDeuX.png)\n## `new PHYSICS.PlaneModule()`\n```javascript\nconst plane = new WHS.Plane({\n  geometry: {\n    width: 100,\n    height: 100\n  },\n  \n  modules: [\n    new PHYSICS.PlaneModule({\n      mass: 5\n    })\n  ],\n  \n  material: new THREE.MeshBasicMaterial({color: 0xff0000})\n});\n\nplane.addTo(app);\n```\n\n## `new PHYSICS.CapsuleModule()`\nNo example yet.\n\n## `new PHYSICS.ConeModule()`\n```javascript\nconst sphere = new WHS.Cylinder({\n  geometry: {\n    radiusTop: 0,\n    radiusBottom: 3,\n    height: 4\n  },\n  \n  modules: [\n    new PHYSICS.ConeModule({\n      mass: 2\n    })\n  ],\n  \n  material: new THREE.MeshBasicMaterial({color: 0xff0000})\n});\n\nbox.addTo(app);\n```\n## `new PHYSICS.ConvexModule()`\n```javascript\nconst teapot = new WHS.Model({\n  geometry: {\n    path: 'path/to/teapot.json'\n  },\n  \n  modules: [\n    new PHYSICS.ConvexModule({\n      mass: 2,\n      path: 'path/to/simplified/teapot.json'\n    })\n  ],\n  \n  material: new THREE.MeshBasicMaterial({color: 0xff0000})\n});\n\nteapot.addTo(app);\n```\n## `new PHYSICS.CylinderModule()`\n```javascript\nconst sphere = new WHS.Cylinder({\n  geometry: {\n    radiusTop: 3,\n    radiusBottom: 3,\n    height: 4\n  },\n  \n  modules: [\n    new PHYSICS.CylinderModule({\n      mass: 2\n    })\n  ],\n  \n  material: new THREE.MeshBasicMaterial({color: 0xff0000})\n});\n\nbox.addTo(app);\n```\n\n![](http://i.imgur.com/WohSp97.png)\n## `new PHYSICS.HeightfieldModule()`\n```javascript\nconst terrain = new WHS.Parametric({\n  geometry: {\n    func: myFunction\n  },\n  \n  modules: [\n    new PHYSICS.HeightfieldModule({\n      mass: 5,\n      size: new THREE.Vector2(100, 100),\n      autoAlign: true // center physics object automatically.\n    })\n  ],\n  \n  material: new THREE.MeshBasicMaterial({color: 0xff0000})\n});\n\nterrain.addTo(app);\n```\n\n![](http://i.imgur.com/h6Z8IIq.png)\n\n## `new PHYSICS.CompoundModule()`\nThis module should be used only if you want to create a copmound physics object without shape and then add needed objects. `CompoundModule` is selected by default if you add object to another object.\n\n## `new PHYSICS.ConcaveModule()`\n```javascript\nconst teapot = new WHS.Model({\n  geometry: {\n    path: 'path/to/teapot.json'\n  },\n  \n  modules: [\n    new PHYSICS.ConcaveModule({\n      mass: 2,\n      path: 'path/to/simplified/teapot.json'\n    })\n  ],\n  \n  material: new THREE.MeshBasicMaterial({color: 0xff0000})\n});\n\nteapot.addTo(app);\n```\n\n![](http://i.imgur.com/aoJ7fgv.jpg)\n## `new PHYSICS.SoftbodyModule()`\n```javascript\nconst sphere = new WHS.Icosahedron({\n  geometry: {\n    radius: 3,\n    detial: 2\n  },\n  \n  modules: [\n    new PHYSICS.SoftbodyModule({\n      mass: 5,\n      pressure: 500\n    })\n  ],\n  \n  material: new THREE.MeshBasicMaterial({color: 0xff0000})\n});\n\nsphere.addTo(app);\n```\n## `new PHYSICS.ClothModule()`\n\n\u003e Used only with `WHS.Plane`\n\n```javascript\nconst cloth = new WHS.Plane({\n  geometry: {\n    width: 100,\n    height: 50\n  },\n  \n  modules: [\n    new PHYSICS.ClothModule({\n      mass: 5\n    })\n  ],\n  \n  material: new THREE.MeshBasicMaterial({color: 0xff0000})\n});\n\ncloth.addTo(app);\n```\n\n## `new PHYSICS.RopeModule()`\n\n```javascript\nconst rope = new WHS.Line({\n  geometry: {\n    curve: new THREE.LineCurve3(new THREE.Vector3(0, 10, 0), new THREE.Vector3(0, 20, 0))\n  },\n  \n  modules: [\n    new PHYSICS.RopeModule({\n      mass: 5\n    })\n  ],\n  \n  material: new THREE.MeshBasicMaterial({color: 0xff0000})\n});\n\nrope.addTo(app);\n```\n\n# Additional available physics parameters\n## RigidBody\n\n```javascript\n{\n  restitution: 0.3,\n  friction: 0.8,\n  damping: 0,\n  margin: 0\n}\n```\n\n## SodtBody (`SoftModule`, `ClothModule`, `RopeModule`)\n\n```javascript\n{\n  friction: 0.8,\n  damping: 0,\n  margin: 0,\n  klst: 0.9,\n  kvst: 0.9,\n  kast: 0.9,\n  piterations: 1,\n  viterations: 0,\n  diterations: 0,\n  citerations: 4,\n  anchorHardness: 0.7,\n  rigidHardness: 1\n}\n```\n\n## FAQ\n**Q: My `ClothModule` doesn't work properly, what to do?**\n\nA: In 90% cases it is because you have set `pressure` parameter. You shouldn't set it for `ClothModule`.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhitestormjs%2Fphysics-module-oimojs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwhitestormjs%2Fphysics-module-oimojs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhitestormjs%2Fphysics-module-oimojs/lists"}