Miss any of our Open RFC calls?Watch the recordings here! »

three-to-cannon

3.0.2 • Public • Published

three-to-cannon

Latest NPM release Minzipped size License Build Status

Convert a THREE.Mesh to a CANNON.Shape, and optional optimizations with simplified shapes.

Usage

Installation:

npm install --save three-to-cannon

Import:

// ES6
import { threeToCannon } from 'three-to-cannon';
 
// CommonJS
threeToCannon = require('three-to-cannon').threeToCannon;

Use:

// Automatic.
const shape = threeToCannon(object3D);
 
// Bounding box (AABB).
const shape = threeToCannon(object3D, {type: threeToCannon.Type.BOX});
 
// Bounding sphere.
const shape = threeToCannon(object3D, {type: threeToCannon.Type.SPHERE});
 
// Cylinder.
const shape = threeToCannon(object3D, {type: threeToCannon.Type.CYLINDER});
 
// Convex hull.
const shape = threeToCannon(object3D, {type: threeToCannon.Type.HULL});
 
// Mesh (not recommended).
const shape = threeToCannon(object3D, {type: threeToCannon.Type.MESH});

Install

npm i three-to-cannon

DownloadsWeekly Downloads

254

Version

3.0.2

License

MIT

Unpacked Size

320 kB

Total Files

14

Last publish

Collaborators

  • avatar