H5
1. 加载扩展库
1.2. Cannon.js
一个简单好用的3D物理库
调试
var world = new CANNON.World();
var scene = new THREE.Scene();
var cannonDebugRenderer = new CANNON.CannonDebugRenderer( scene, world );
// ...add things to world and scene...
function render() {
requestAnimationFrame( render );
world.step( timeStep ); // Update physics
cannonDebugRenderer.update(); // Update the debug renderer
renderer.render( scene, camera ); // Render the scene
}
render();