浏览代码

Improve collision handling

Paul Masson 7 年之前
父节点
当前提交
fd1ad09fb8
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      examples/webvr_gearvr.html

+ 4 - 0
examples/webvr_gearvr.html

@@ -231,6 +231,10 @@
 						
 						
 						if ( normal.length() < 2 * radius ) {
 						if ( normal.length() < 2 * radius ) {
 							
 							
+							normal.multiplyScalar( 0.5 * normal.length() - radius );
+							cube.position.sub( normal );
+							cube2.position.add( normal );
+
 							normal.normalize();
 							normal.normalize();
 
 
 							relativeVelocity.copy( cube.userData.velocity ).sub( cube2.userData.velocity );
 							relativeVelocity.copy( cube.userData.velocity ).sub( cube2.userData.velocity );