提交 960ce5a5 编写于 作者: M Mr.doob

Improved webvr_daydream physics performance.

上级 93f0618d
......@@ -19,7 +19,7 @@
overflow: hidden;
}
a {
color: #f00;
color: #48f;
}
</style>
</head>
......@@ -206,18 +206,20 @@
normal.copy( cube.position ).sub( cube2.position );
if ( normal.length() < 2 * radius ) {
var distance = normal.length();
if ( distance < 2 * radius ) {
normal.multiplyScalar( 0.5 * distance - 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 );
var dot = relativeVelocity.dot( normal );
normal = normal.multiplyScalar( dot );
normal = normal.multiplyScalar( relativeVelocity.dot( normal ) );
cube.userData.velocity.sub( normal );
cube2.userData.velocity.add( normal );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册