在先前版本的Three.js中,我使用的是getWorldRotation()
const sourceObject3D = sourceEntity.object3D
// Rotation
{
const sourceAngle = three.Math.radToDeg(
sourceObject3D.getWorldRotation().y
)
const prevAngle = three.Math.radToDeg(
targetEntity.object3D.getWorldRotation().y
)
现在折旧了。
我尝试将其替换为getWorldQuaternion()
var quaternion = new three.Quaternion()
sourceEntity.object3D.getWorldQuaternion( quaternion )
var vector = new three.Vector3()
vector.applyQuaternion( quaternion )
const sourceAngle = three.Math.radToDeg(vector.y)
var tquaternion = new three.Quaternion()
targetEntity.object3D.getWorldQuaternion( tquaternion )
var tvector = new three.Vector3()
tvector.applyQuaternion( tquaternion )
const prevAngle = three.Math.radToDeg(tvector.y)
但是targetEntity四元组始终为Quaternion {_x: 0, _y: 0, _z: 0, _w: 1}
为什么会这样?这是替换getWorldRotation()