All Projects → WhitestormJS → physics-module-ammonext

WhitestormJS / physics-module-ammonext

Licence: other
Physics module for Whitestorm.js [Beta]

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to physics-module-ammonext

03-Unstable-Rotation
The code for my Game Physics course: https://www.udemy.com/gamephysics
Stars: ✭ 21 (-44.74%)
Mutual labels:  physics
Torque
2d 纯计算高性能刚体物理引擎
Stars: ✭ 62 (+63.16%)
Mutual labels:  physics
LocalSimulation
This plugin allows you to essentially create PxScene or Physic Scenes by placing an Actor, and adding other Static Mesh Components and soon Skeletal Mesh components within this space. Adding Constraints, and Forces will work as expected, but now with the additional layer of abstraction so that simulation can be anchored to a transform.
Stars: ✭ 42 (+10.53%)
Mutual labels:  physics
harmonica
A simple, physics-based animation library 🎼
Stars: ✭ 571 (+1402.63%)
Mutual labels:  physics
harfang3d
HARFANG 3D source code public repository
Stars: ✭ 173 (+355.26%)
Mutual labels:  physics
pylj
Teaching Utility for Classical Atomistic Simulation.
Stars: ✭ 23 (-39.47%)
Mutual labels:  physics
NMRI
2D Fourier Transform of Nuclear Magnetic Resonance Imaging raw data
Stars: ✭ 13 (-65.79%)
Mutual labels:  physics
Physics
experimenting with physics simulation
Stars: ✭ 53 (+39.47%)
Mutual labels:  physics
lab-dotphy
The Virtual Lab for Physics
Stars: ✭ 14 (-63.16%)
Mutual labels:  physics
My NoteBook
サイエンス、テクノロジー、エンジニアリング関連の情報を記載したノート(忘備録)です。
Stars: ✭ 104 (+173.68%)
Mutual labels:  physics
physics-learning-path
This is my physics learning path. Best courses I've found to learn physics online.
Stars: ✭ 37 (-2.63%)
Mutual labels:  physics
diffractsim
✨ A diffraction simulator for exploring and visualizing physical optics.
Stars: ✭ 239 (+528.95%)
Mutual labels:  physics
kosm
Kosm for Android source code
Stars: ✭ 33 (-13.16%)
Mutual labels:  physics
MachineLearning Physics
This is to facilitate the “Machine Learning in Physics” course that I am teaching at Sharif University of Technology for winter-19 semester. For more information, see the course page at
Stars: ✭ 26 (-31.58%)
Mutual labels:  physics
GooFit
Code repository for the massively-parallel framework for maximum-likelihood fits, implemented in CUDA/OpenMP
Stars: ✭ 112 (+194.74%)
Mutual labels:  physics
diepssect
A public repo for hacky diep stuff - networking protocol, WebAssembly, memory editing, & physics
Stars: ✭ 26 (-31.58%)
Mutual labels:  physics
jitternator
Lessons learnt from hunting jitter issues
Stars: ✭ 59 (+55.26%)
Mutual labels:  physics
mujoco
Multi-Joint dynamics with Contact. A general purpose physics simulator.
Stars: ✭ 4,685 (+12228.95%)
Mutual labels:  physics
lumin
LUMIN - a deep learning and data science ecosystem for high-energy physics.
Stars: ✭ 45 (+18.42%)
Mutual labels:  physics
Raymarched-GPU-Particles-with-Screenspace-Physics
Using Grab Passes for VRChat
Stars: ✭ 44 (+15.79%)
Mutual labels:  physics

physics-module-ammonext NPM Version

Physics module for Whitestorm.js [Beta]

Go to WhitestormJS/whitestorm.js

physics module

Modules list

new PHYSICS.WorldModule()

const app = new WHS.App([
  // ...
  new PHYSICS.WorldModule({
    gravity: new THREE.Vector3(0, -10, 0),
    ammo: 'path/to/ammo.js'
  })
]);

app.start();

new PHYSICS.BoxModule()

const box = new WHS.Box({
  geometry: {
    width: 2,
    height: 2,
    depth: 4
  },
  
  modules: [
    new PHYSICS.BoxModule({
      mass: 10
    })
  ],
  
  material: new THREE.MeshBasicMaterial({color: 0xff0000})
});

box.addTo(app);

new PHYSICS.SphereModule()

const sphere = new WHS.Box({
  geometry: {
    radius: 3
  },
  
  modules: [
    new PHYSICS.SphereModule({
      mass: 10
    })
  ],
  
  material: new THREE.MeshBasicMaterial({color: 0xff0000})
});

sphere.addTo(app);

new PHYSICS.PlaneModule()

const plane = new WHS.Plane({
  geometry: {
    width: 100,
    height: 100
  },
  
  modules: [
    new PHYSICS.PlaneModule({
      mass: 5
    })
  ],
  
  material: new THREE.MeshBasicMaterial({color: 0xff0000})
});

plane.addTo(app);

new PHYSICS.CapsuleModule()

No example yet.

new PHYSICS.ConeModule()

const sphere = new WHS.Cylinder({
  geometry: {
    radiusTop: 0,
    radiusBottom: 3,
    height: 4
  },
  
  modules: [
    new PHYSICS.ConeModule({
      mass: 2
    })
  ],
  
  material: new THREE.MeshBasicMaterial({color: 0xff0000})
});

box.addTo(app);

new PHYSICS.ConvexModule()

const teapot = new WHS.Model({
  geometry: {
    path: 'path/to/teapot.json'
  },
  
  modules: [
    new PHYSICS.ConvexModule({
      mass: 2,
      path: 'path/to/simplified/teapot.json'
    })
  ],
  
  material: new THREE.MeshBasicMaterial({color: 0xff0000})
});

teapot.addTo(app);

new PHYSICS.CylinderModule()

const sphere = new WHS.Cylinder({
  geometry: {
    radiusTop: 3,
    radiusBottom: 3,
    height: 4
  },
  
  modules: [
    new PHYSICS.CylinderModule({
      mass: 2
    })
  ],
  
  material: new THREE.MeshBasicMaterial({color: 0xff0000})
});

box.addTo(app);

new PHYSICS.HeightfieldModule()

const terrain = new WHS.Parametric({
  geometry: {
    func: myFunction
  },
  
  modules: [
    new PHYSICS.HeightfieldModule({
      mass: 5,
      size: new THREE.Vector2(100, 100),
      autoAlign: true // center physics object automatically.
    })
  ],
  
  material: new THREE.MeshBasicMaterial({color: 0xff0000})
});

terrain.addTo(app);

new PHYSICS.CompoundModule()

This 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.

new PHYSICS.ConcaveModule()

const teapot = new WHS.Model({
  geometry: {
    path: 'path/to/teapot.json'
  },
  
  modules: [
    new PHYSICS.ConcaveModule({
      mass: 2,
      path: 'path/to/simplified/teapot.json'
    })
  ],
  
  material: new THREE.MeshBasicMaterial({color: 0xff0000})
});

teapot.addTo(app);

new PHYSICS.SoftbodyModule()

const sphere = new WHS.Icosahedron({
  geometry: {
    radius: 3,
    detial: 2
  },
  
  modules: [
    new PHYSICS.SoftbodyModule({
      mass: 5,
      pressure: 500
    })
  ],
  
  material: new THREE.MeshBasicMaterial({color: 0xff0000})
});

sphere.addTo(app);

new PHYSICS.ClothModule()

Used only with WHS.Plane

const cloth = new WHS.Plane({
  geometry: {
    width: 100,
    height: 50
  },
  
  modules: [
    new PHYSICS.ClothModule({
      mass: 5
    })
  ],
  
  material: new THREE.MeshBasicMaterial({color: 0xff0000})
});

cloth.addTo(app);

new PHYSICS.RopeModule()

const rope = new WHS.Line({
  geometry: {
    curve: new THREE.LineCurve3(new THREE.Vector3(0, 10, 0), new THREE.Vector3(0, 20, 0))
  },
  
  modules: [
    new PHYSICS.RopeModule({
      mass: 5
    })
  ],
  
  material: new THREE.MeshBasicMaterial({color: 0xff0000})
});

rope.addTo(app);

Additional available physics parameters

RigidBody

{
  restitution: 0.3,
  friction: 0.8,
  damping: 0,
  margin: 0
}

SoftBody (SoftModule, ClothModule, RopeModule)

{
  friction: 0.8,
  damping: 0,
  margin: 0,
  klst: 0.9,
  kvst: 0.9,
  kast: 0.9,
  piterations: 1,
  viterations: 0,
  diterations: 0,
  citerations: 4,
  anchorHardness: 0.7,
  rigidHardness: 1
}

Events

collision

Example

player.on('collision', (otherObject, v, r, contactNormal) => {
  if (contactNormal.y < 0.5) // Use a "good" threshold value between 0 and 1 here!
    canJump = true;
});

FAQ

Q: My ClothModule doesn't work properly, what to do?

A: In 90% cases it is because you have set pressure parameter. You shouldn't set it for ClothModule.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].