Three.js - Can I 'apply' position, rotation, and scale to the geometry?

前端 未结 1 410
说谎
说谎 2020-12-03 11:21

I\'d like to edit an object\'s position, rotation, and scale vectors, then \'apply\' them to the geometry, which would zero-out those vectors, but retain the transformation.

相关标签:
1条回答
  • 2020-12-03 12:13

    You can apply an object's transform to the object's geometry directly, and then reset the position, rotation, and scale like so:

    object.updateMatrix();
    
    object.geometry.applyMatrix( object.matrix );
    
    object.position.set( 0, 0, 0 );
    object.rotation.set( 0, 0, 0 );
    object.scale.set( 1, 1, 1 );
    object.updateMatrix();
    

    three.js r.69

    0 讨论(0)
提交回复
热议问题