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

Merge remote-tracking branch 'jsermeno/ortho' into dev

......@@ -40,7 +40,7 @@ THREE.Projector = function() {
_projScreenMatrix.multiplyVector3( vector );
return vector;
};
this.unprojectVector = function ( vector, camera ) {
......@@ -49,7 +49,31 @@ THREE.Projector = function() {
_projScreenMatrix.multiplyVector3( vector );
return vector;
};
/**
* Translates a 2D point from NDC to a THREE.Ray
* that can be used for picking.
* @vector - THREE.Vector3 that represents 2D point
* @camera - THREE.Camera
*/
this.pickingRay = function ( vector, camera ) {
var end, ray, t;
// set two vectors with opposing z values
vector.z = -1.0;
end = new THREE.Vector3( vector.x, vector.y, 1.0 );
this.unprojectVector( vector, camera );
this.unprojectVector( end, camera );
// find direction from vector to end
end.subSelf( vector ).normalize();
return new THREE.Ray( vector, end );
};
this.projectObjects = function ( scene, camera, sort ) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册