求助!3d摇杆根据摇杆方向进行3d模型人物转向

求助!3d摇杆根据摇杆方向进行3d模型人物转向的思路 求大佬帮助

http://store.cocos.com/app/detail/2882
可以参考看看 赛尔达demo里的方案哈

private rotation = new Quat();
update(deltatime){
Quat.fromViewUp(this.rotation, v3(this.v, 0, this.h));
this.node.rotation = this.node.rotation.lerp(this.rotation, deltatime * this.rotationSpeed);
}

h,v是摇杆的方向

恩恩 谢谢大佬

我试试哈 多谢大佬!

大佬 如果根据摇杆改变了模型的方向 如何改变这个模型的lookat呢

模型的朝向?

恩 对是这个意思 因为我有一个跟随相机 当模型转向的时候我想把相机的角度一直都对着3d人物的背面

Quat.fromViewUp(this.rotation, v3(this.v, 0, this.h));
this.node.rotation = this.node.rotation.lerp(this.rotation, deltatime * this.rotationSpeed);
改成:
let atan = (Math.atan2(-this.v,-this.h) * this.rad2Deg) + 摄像机的eulerAngles.y;
this.node.eulerAngles = v3(0,atan,0);

请问下 我用了你提供的代码 角色可以旋转 但是到会出现图的情况 人物扁了

求助下。。。。 转的时候不知为什么会扁了

用了物理碰撞吗?需要把刚体的Angular Factor的x和z设置为0

你好 感谢回复这个问题已经解决了


请问你知道如何给自己引入的模型添加刚体和物理碰撞吗
我加了 发现碰撞体没法对应在人物上 导致没法产生物理效果 人物会直接穿过地板

image

用胶囊体,不要用Mesh碰撞器

我有代码,你需要不?