如下方效果动图,快速的移动与调整forword,灰色小人就会出现乱旋转。在3D下没有像2D的fixrotaion这样的参数。
以下是灰色小人的设置参数,不知道如何才能让灰色小人不倾倒
你旋转只转y轴
上小人旋转的代码看看呀
想实现的效果就是人人受击后,有颤抖的效果(因为没有动画,所以只能模拟)
let nodePos = this.node.eulerAngles
this.scriptPlayerModel.ishit = true
tween(nodePos)
.to(0.05, new Vec3(nodePos.x, nodePos.y+3, nodePos.z ), { easing: 'bounceIn' }).call(() => {
this.node.eulerAngles = nodePos
})
.to(0.05, new Vec3(nodePos.x, nodePos.y-3, nodePos.z ), { easing: 'bounceOut' }).call(() => {
this.node.eulerAngles = nodePos
})
.union()
.repeat(3) // 执行 2 次
.call(() => {
//结束颤抖
this.scriptPlayerModel.ishit = false
this.node.eulerAngles = nodePos
})
.start();