2017-11-25 15 views
0

안녕하세요 저는 BABYONJS에서 장면을 만들었습니다. solor system BABYONjs에서 저는 지구 자체를 회전 시켰습니다.하지만 arround를 움직이려고했는데 어떤 아이디어도 작동하지 않았습니까?BABYLONJS에서 메쉬를 움직이는 방법은 무엇입니까?

내 코드

자동 회전

scene.beforeRender = function() {  
     newEarth.rotate(new BABYLON.Vector3(0, 1, 0) , 0.01, 
     BABYLON.Space.WORLD); 
}; 

의 필요성은 지구가 난 솔루션 우리가 아래 arround를

여기 enter image description here

답변

0

을 이동해야합니다입니다 피벗 매트릭스

currentMesh.setPivotMatrix(BABYLON.Matrix.Translation(70, 0, 0)); 
    camera.attachControl(canvas, true); 
    scene.registerBeforeRender(function() { 
     if (currentMesh) { 
      currentMesh.rotate(BABYLON.Axis.Y, Math.PI/64, 
       BABYLON.Space.LOCAL); 
     } 
    }); 

이것을 시도하십시오.