
Three到Cannon:将THREE.Mesh转为CANNON.Shape
5星
- 浏览量: 0
- 大小:None
- 文件类型:None
简介:
本文介绍了如何在物理模拟引擎CANNON.js中使用来自3D渲染库three.js的模型。具体地,讲解了将THREE.Mesh对象转换成CANNON.Shape对象的过程与方法。
三加农炮可以将THREE.Mesh转换为CANNON.Shape,并提供简化的形状进行可选的优化。
安装:
```
npm install --save three-to-cannon
```
导入:
```javascript
// ES6
import { threeToCannon } from three-to-cannon;
// CommonJS
const threeToCannon = require(three-to-cannon).threeToCannon;
```
使用方法:
自动转换为适当形状:
```javascript
const shape = threeToCannon(object3D);
```
使用包围盒(AABB)进行简化优化:
```javascript
const shape = threeToCannon(object3D, { type: threeToCannon.Type.BOX });
```
全部评论 (0)
还没有任何评论哟~


