Skip to content

Commit 318be01

Browse files
committed
Vector3.unproject(): Avoid computing inverse
1 parent 3b2137d commit 318be01

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

src/math/Vector3.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { _Math } from './Math.js';
2-
import { Matrix4 } from './Matrix4.js';
32
import { Quaternion } from './Quaternion.js';
43

54
/**
@@ -320,15 +319,9 @@ Object.assign( Vector3.prototype, {
320319

321320
unproject: function () {
322321

323-
var matrix = new Matrix4();
322+
return this.applyMatrix4( camera.projectionMatrixInverse ).applyMatrix4( camera.matrixWorld );
324323

325-
return function unproject( camera ) {
326-
327-
return this.applyMatrix4( matrix.getInverse( camera.projectionMatrix ) ).applyMatrix4( camera.matrixWorld );
328-
329-
};
330-
331-
}(),
324+
},
332325

333326
transformDirection: function ( m ) {
334327

0 commit comments

Comments
 (0)