MCPcopy
hub / github.com/lo-th/Oimo.js

github.com/lo-th/Oimo.js @main sqlite

repository ↗ · DeepWiki ↗
902 symbols 2,493 edges 128 files 64 documented · 7%
README

Oimo.js is a lightweight 3d physics engine for JavaScript.

It's a full javascript conversion of OimoPhysics

Originally created by Saharan for actionscript 3.0.

Version

Version

Home

Docs

  • docs (in progress)

Demo

Usage

Download the minified library and include it in your HTML.

Alternatively, use Node and install the package: npm install oimo

<script src="https://github.com/lo-th/Oimo.js/raw/main/js/oimo.min.js"></script>

Create physics world:

world = new OIMO.World({ 
    timestep: 1/60, 
    iterations: 8, 
    broadphase: 2, // 1 brute force, 2 sweep and prune, 3 volume tree
    worldscale: 1, // scale full world 
    random: true,  // randomize sample
    info: false,   // calculate statistic or not
    gravity: [0,-9.8,0] 
});

Add physics object or joint

var body = world.add({ 
    type:'sphere', // type of shape : sphere, box, cylinder 
    size:[1,1,1], // size of shape
    pos:[0,0,0], // start position in degree
    rot:[0,0,90], // start rotation in degree
    move:true, // dynamic or statique
    density: 1,
    friction: 0.2,
    restitution: 0.2,
    belongsTo: 1, // The bits of the collision groups to which the shape belongs.
    collidesWith: 0xffffffff // The bits of the collision groups with which the shape collides.
});

var body = world.add({ 
    type:'jointHinge', // type of joint : jointDistance, jointHinge, jointPrisme, jointSlide, jointWheel
    body1: "b1", // name or id of attach rigidbody
    body2: "b1" // name or id of attach rigidbody
});


// update world
world.step();

// and copy position and rotation to three mesh
myMesh.position.copy( body.getPosition() );
myMesh.quaternion.copy( body.getQuaternion() );

Note

Oimo Physics uses international system units: 0.1 to 10 meters max for dynamic body.

In basic demo with THREE, I scaled all by 100 so objects are between 10 to 1000 in THREE units.

/!\ Shape name change in last version

SphereShape to Sphere, BoxShape to Box, CylinderShape to Cylinder

UPDATE

Is time to switch ES6 worker version with the last OimoPhysics 1.2.2 :)

go to new PHY repro

Core symbols most depended-on inside this repo

printError
called by 33
src/core/Utils.js
add
called by 27
examples/js/main.js
switchMat
called by 18
examples/js/main.js
cam
called by 15
examples/js/main.js
nextLine
called by 10
examples/js/loaders/BVHLoader.js
grad
called by 8
examples/js/ImprovedNoise.js
lerp
called by 7
examples/js/ImprovedNoise.js
getZoomScale
called by 6
examples/js/controls/OrbitControls.js

Shape

Function 902

Languages

TypeScript100%

Modules by API surface

examples/js/libs/codemirror.min.js360 symbols
examples/js/libs/three.min.js309 symbols
examples/js/controls/OrbitControls.js31 symbols
examples/js/worker/oimo.worker.js15 symbols
examples/js/main.js13 symbols
examples/js/docs.js11 symbols
examples/js/navigation.js10 symbols
examples/js/libs/sea3d.min.js10 symbols
examples/demos/kinematic3.js7 symbols
examples/js/loaders/BVHLoader.js6 symbols
examples/js/ImprovedNoise.js4 symbols
examples/demos/tower.js3 symbols

Dependencies from manifests, versioned

eslintlatest · 1×
eslint-config-mdcslatest · 1×
rolluplatest · 1×
rollup-watchlatest · 1×
terserlatest · 1×

For agents

$ claude mcp add Oimo.js \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact