var ShipGeometry = new THREE.Geometry();
var ShipModule1geo = new THREE.SphereGeometry( 150.0, 40, 30 );
ShipGeometry.merge(ShipModule1geo); // this works
var ShipModule2geo = new THREE.BoxGeometry( 5.0, 5.0, 600, 1, 1, 1 );
var matrix = new THREE.Matrix4().makeTranslation(0,0,450);
ShipGeometry.merge(ShipModule2geo,matrix); // this works too
var ShipModule3geo = new THREE.CylinderGeometry( 150, 150, 20, 32 );
var matrix = new THREE.Matrix4().makeTranslation(0, 0, 850).makeRotationZ(Math.PI/2);
ShipGeometry.merge(ShipModule3geo,matrix); // only rotation is applyed
shipMesh = new THREE.Mesh( ShipGeometry, ShipMaterial );
....
我的问题是,为什么在最后一种情况下只应用 makeTranslation(0, 0, 850)
,不 makeRotationZ(Math.PI/2)
?
如何在合并之前应用两者?
答案 0 :(得分:0)
您可以像这样应用两个矩阵:
var matrix = new THREE.Matrix4();
matrix.multiply( new THREE.Matrix4().makeTranslation(0, 0, 850) );
matrix.multiply( new THREE.Matrix4().makeRotationZ(Math.PI/2) );