Browse Source

Examples: Improved Rapier example.

Mr.doob 1 năm trước cách đây
mục cha
commit
8416704d2e

+ 4 - 4
examples/jsm/physics/RapierPhysics.js

@@ -1,6 +1,6 @@
 import { Clock, Vector3, Quaternion, Matrix4 } from 'three';
 
-const RAPIER_PATH = 'https://cdn.skypack.dev/@dimforge/[email protected]1.2';
+const RAPIER_PATH = 'https://cdn.skypack.dev/@dimforge/[email protected].0';
 
 const frameRate = 60;
 
@@ -9,7 +9,7 @@ const ZERO = new Vector3();
 
 let RAPIER = null;
 
-function getCollider( geometry ) {
+function getShape( geometry ) {
 
 	const parameters = geometry.parameters;
 
@@ -43,7 +43,7 @@ async function RapierPhysics() {
 
 	}
 
-	// Docs: https://rapier.rs/docs/api/javascript/JavaScript3D/	
+	// Docs: https://rapier.rs/docs/api/javascript/JavaScript3D/
 
 	const gravity = new Vector3( 0.0, - 9.81, 0.0 );
 	const world = new RAPIER.World( gravity );
@@ -77,7 +77,7 @@ async function RapierPhysics() {
 
 	function addMesh( mesh, mass = 0, restitution = 0 ) {
 
-		const shape = getCollider( mesh.geometry );
+		const shape = getShape( mesh.geometry );
 
 		if ( shape === null ) return;
 

+ 1 - 1
examples/physics_rapier_instancing.html

@@ -9,7 +9,7 @@
 	<body>
 
 		<div id="info">
-			<a href="https://threejs.org" target="_blank" rel="noopener">three.js</a> physics - rapier3d instancing
+			<a href="https://threejs.org" target="_blank" rel="noopener">three.js</a> physics - <a href="https://github.com/dimforge/rapier.js" target="_blank">rapier</a> instancing
 		</div>
 
 		<script type="importmap">