我想要沿z轴旋转指定的一个Cube 90度。使用tween实现,但旋转过程中出现了缩放操作,如何让物体只旋转而不进行缩放?求大神指教!
旋转功能代码:
tween(this.node)
.to(2, { rotation: Quat.fromEuler(new Quat(0, 0, 0), 0, 0, 90) })
.start()
我打印了旋转过程中Cube的scale变化情况:
update(deltaTime: number) {
console.log(this.node.worldScale
}
Cube初始scale为(x: 2, y: 1, z: 0.5)在缩小过程中,部分打印结果如下:
Object { x: 1.9401026795846192, y: 0.9700513397923096, z: 0.5 }
Object { x: 1.9365246142946702, y: 0.9682623071473351, z: 0.5 }
Object { x: 1.9328506817269369, y: 0.9664253408634684, z: 0.5 }
Object { x: 1.9290837611389167, y: 0.9645418805694583, z: 0.5 }
Object { x: 1.924983002955012, y: 0.962491501477506, z: 0.5 }
Object { x: 1.9205349007134391, y: 0.9602674503567196, z: 0.5 }
如果将 tween(this.node).to
方法改为 tween(this.node).by
,则缩放操作更明显,且scale不会再返原为(2, 1, 0.5)
请问如何让3d物体进行正确的旋转操作?感谢大神指点!