How to rotate a object on axis world three.js?

后端 未结 5 1418
深忆病人
深忆病人 2020-12-03 05:35

Is it possible to do rotations taking axis of the world and not of the object?

I need to do some rotations of an object, but after the first rotation, I can\'t do ot

5条回答
  •  盖世英雄少女心
    2020-12-03 05:52

    THREE - r107

    // select the Z world axis
    this.myAxis = new Vector3(0, 0, 1);
    
    // rotate the mesh 45 on this axis
    this.mesh.rotateOnWorldAxis(this.myAxis, Math.degToRad(45));
    
    animate() {
    // rotate our object on its Y axis, 
    // but notice the cube has been transformed on world axis, so it will be tilted 45deg.
      this.mesh.rotation.y += 0.008;
    }
    

提交回复
热议问题