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

Added Vector3.absoluteToRelative and Vector3.relativeToAbsolute. Thanks to...

Added Vector3.absoluteToRelative and Vector3.relativeToAbsolute. Thanks to @G3z for the initial suggestion. Thanks to @em for the naming hint. Fixes #1043.
上级 ab7c7251
......@@ -255,6 +255,17 @@ THREE.Vector3.prototype = {
},
relativeToAbsolute: function ( object ) {
return object.matrixWorld.multiplyVector3( this.clone() );
},
absoluteToRelative: function ( object ) {
return new THREE.Matrix4().getInverse( object.matrixWorld ).multiplyVector3( this.clone() );
},
distanceTo: function ( v ) {
......@@ -268,7 +279,6 @@ THREE.Vector3.prototype = {
},
setPositionFromMatrix: function ( m ) {
this.x = m.n14;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册