2017-11-25 77 views
0

嗨我已经在BABYONJS中创建了一个场景,我试图在BABYONjs中实现solod系统这里我让地球自转,但我试图移动不能运行的任何想法的arround。如何使网格在BABYLONJS中移动?

我的代码

自旋转

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

需要的是地球应角落找寻移动

enter image description here

回答

0

这里下面我有办法解决我们ing枢轴矩阵

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); 
     } 
    }); 

试试这个。