[]如何通过鼠标滑动使模型360度旋转查看呢?

看有些网上的实例是通过鼠标滑动查看模型的各个角度,请问Laya3D怎么弄呀,初学者,希望给点指引。。。
已邀请:

Supermang42

赞同来自:

看看拖曳相關的資料然後去更改模型的Rotation。

君昊

赞同来自:

x.on(Laya.Event.MOUSE_DOWN,this,this.onDownHander);
x.on(Laya.Event.MOUSE_UP,this,this.onUpHander);
private onDownHander(e:Laya.Event):void{ if(x)x.on(Laya.Event.MOUSE_MOVE,this,this.onMoseUnit);}
private onUpHander(e:Laya.Event):void{if(x)x.off(Laya.Event.MOUSE_MOVE,this,this.onMoseUnit);}
private onMoseUnit(e:Laya.Event):void { if(!e)return; this.onShowRotation((this.curMouseX - e.stageX)%360);this.curMouseX = e.stageX;}
public onShowRotation(_y:number = 0):void{x.transform.rotate(new Laya.Vector3(0,_y,0),false,false)}
就可以实现鼠标左右移动3d模型进行旋转的了,至于(this.curMouseX - e.stageX)%360)为什么这样计算,能懂就懂吧,x,就是监听的父类对象容器

要回复问题请先

商务合作
商务合作