我正在尝试将玩家(THREE.Object3d())的位置和旋转值线性插值到所需的(THREE.Vector3())。
这是我的代码:
player.position.lerp(desiredPosition, 0.2);
player.rotation.lerp(desiredRotation, 0.2);
Run Code Online (Sandbox Code Playgroud)
但我收到以下错误:
未捕获的类型错误:player.rotation.lerp 不是函数
我知道有一个player.quaternion.slerp()函数,但是有没有办法x, y, z在不使用四元数的情况下插入旋转值?
如果没有,我怎样才能将desiredRotation( THREE.Vector3())转换为THREE.Quaternion()这样我就可以使用该slerp()函数了?
所需的旋转(THREE.Vector3())
Object3D.rotation不是类型THREE.Vector3而是THREE.Euler。使用Quaternion.setFromEuler()根据欧拉角设置四元数值。
| 归档时间: |
|
| 查看次数: |
1736 次 |
| 最近记录: |