1
German corner / Re: Übertragung von Rotation von einem Object3D zu einem anderen
« on: January 20, 2011, 09:22:03 pm »
Vielen dank!
Hier ein Auszug für jemanden der mal was ähnliches sucht:
Hier ein Auszug für jemanden der mal was ähnliches sucht:
Code: [Select]
Object3D referenzObj;
SimpleVector origin = referenzObj.getTransformedCenter();
Matrix tranformationMatrix = referenzObj.getWorldTransformation();
Object3D addedObj;
//Set the position to the current position of refernzObj
addedObj.translate(origin);
// Remove the rotational part from the transformation matrix
Matrix newRot = tranformationMatrix.cloneMatrix();
newRot.set(3, 0, 0);
newRot.set(3, 1, 0);
newRot.set(3, 2, 0);
b.setRotationMatrix(newRot);
//Offset to the referenzObj
SimpleVector dir = b.getZAxis();
dir.scalarMul(18);
b.translate(dir);