threejs how to rotate around object's own center,instead of world center

前端 未结 5 744
渐次进展
渐次进展 2020-11-27 03:27

\"enter

two objects in the scene. the cube rotate axis should be the cube\'s center,th

5条回答
  •  盖世英雄少女心
    2020-11-27 03:49

    Heres how i got things to work on r86

    // Store original position
    let box = new THREE.Box3().setFromObject(this.mesh);
    let offset = box.getCenter();
    
    // Center geometry faces
    this.geometry.center();
    
    // Add to pivot group
    this.group = new THREE.Object3D();
    this.group.add(this.mesh);
    
    // Offset pivot group by original position
    this.group.position.set(offset.x, offset.y, offset.z);
    

提交回复
热议问题