Skip to content

Commit

Permalink
USDZLoader: Added transforms support.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdoob committed Sep 6, 2022
1 parent f82bbc9 commit 141011d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions examples/jsm/loaders/USDZLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,15 @@ class USDZLoader extends Loader {

const mesh = new Mesh( geometry, material );

if ( 'matrix4d xformOp:transform' in data ) {

const array = JSON.parse( '[' + data[ 'matrix4d xformOp:transform' ].replace( /[()]*/g, '' ) + ']' );

mesh.matrix.fromArray( array );
mesh.matrix.decompose( mesh.position, mesh.quaternion, mesh.scale );

}

return mesh;

}
Expand Down

0 comments on commit 141011d

Please sign in to comment.