Browse Source

Improve collision handling

Paul Masson 7 years ago
parent
commit
fd1ad09fb8
1 changed files with 4 additions and 0 deletions
  1. 4 0
      examples/webvr_gearvr.html

+ 4 - 0
examples/webvr_gearvr.html

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