作者sleeppig2008 (乂憨憨乂)
看板Flash
標題[問題] 滑鼠拖曳
時間Wed Mar 16 17:26:04 2011
各位高手
我有一個問題阿
就是我程式碼中 有一段是寫說
滑鼠移入就可以改變 視角
但是我想變成 滑鼠點擊(拖曳)來改變
一直處理不好
請各位幫幫我 感謝
以下是我控制視角的程式碼
private function anim(e:Event):void{
var rotY = (stage.mouseX - stage.width/2) / (stage.width/2);
if(rotY >1 || rotY<-1){rotY=0;}
var rotX = (stage.mouseY - stage.height/2) / (stage.height/2);
if(rotX >1 || rotX<-1){rotX=0;}
cam.rotationY +=rotY;
cam.rotationX +=rotX;
if(cam.rotationX >=09){cam.rotationX=09;}
if(cam.rotationX <=-80){cam.rotationX =-80;}
renderer();
}
private function renderer():void{
render.renderScene(scene,cam,view);
}
感謝各位~~
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 120.105.97.5
→ zephyrhymn:3D的camera控制只有片段,要腦補有點困難 給樓下高手 03/17 09:39
→ sleeppig2008:還是要提供原始檔啊?? 03/17 13:31
→ sleeppig2008:做出來了~好開心 03/17 21:44