Skip to content

Commit 8cca287

Browse files
committed
webvr_ballshooter: adjusted shooting speed
1 parent e71d720 commit 8cca287

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

examples/webvr_ballshooter.html

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,9 @@
165165
var object = room.children[ count ++ ];
166166

167167
object.position.copy( controller.position );
168-
object.userData.velocity.x = ( Math.random() - 0.5 ) * 0.02;
169-
object.userData.velocity.y = ( Math.random() - 0.5 ) * 0.02;
170-
object.userData.velocity.z = ( Math.random() * 0.02 - 0.1 );
168+
object.userData.velocity.x = ( Math.random() - 0.5 ) * 3;
169+
object.userData.velocity.y = ( Math.random() - 0.5 ) * 3;
170+
object.userData.velocity.z = ( Math.random() - 9 );
171171
object.userData.velocity.applyQuaternion( controller.quaternion );
172172

173173
if ( count === room.children.length ) count = 0;
@@ -217,7 +217,7 @@
217217
object.position.y = Math.max( object.position.y, radius );
218218

219219
object.userData.velocity.x *= 0.98;
220-
object.userData.velocity.y = - object.userData.velocity.y * 0.9;
220+
object.userData.velocity.y = - object.userData.velocity.y * 0.8;
221221
object.userData.velocity.z *= 0.98;
222222

223223
}
@@ -253,19 +253,12 @@
253253
object.userData.velocity.sub( normal );
254254
object2.userData.velocity.add( normal );
255255

256-
var impact = relativeVelocity.length() / 10;
257-
258-
object.material.emissive.r = Math.min( 1, object.material.emissive.r + impact );
259-
object2.material.emissive.r = Math.min( 1, object2.material.emissive.r + impact );
260-
261256
}
262257

263258
}
264259

265260
object.userData.velocity.y -= 9.8 * delta;
266261

267-
object.material.emissive.r = Math.max( 0, object.material.emissive.r - 0.5 * delta );
268-
269262
}
270263

271264
renderer.render( scene, camera );

0 commit comments

Comments
 (0)