|
@@ -689,13 +689,14 @@ THREE.extend( THREE.Vector3.prototype, {
|
|
|
|
|
|
reflect: function () {
|
|
|
|
|
|
- var v1 = new THREE.Vector3();
|
|
|
+ // reflect incident vector off plane orthogonal to normal
|
|
|
+ // normal is assumed to have unit length
|
|
|
|
|
|
- return function ( vector ) {
|
|
|
+ var v1 = new THREE.Vector3();
|
|
|
|
|
|
- v1.copy( this ).projectOnVector( vector ).multiplyScalar( 2 );
|
|
|
+ return function ( normal ) {
|
|
|
|
|
|
- return this.subVectors( v1, this );
|
|
|
+ return this.sub( v1.copy( normal ).multiplyScalar( 2 * this.dot( normal ) ) );
|
|
|
|
|
|
}
|
|
|
|