bsdzhu
03-26-2009, 05:32 AM
Hi, everyone,
I have 2 objects(A, B) in my scene.
What i want to do is: rotate A along an edge of B( edge name: BEdge, startingpoint: startP, endpoint: endP).
I had placed rotatePivot of A at the position of startP, and when i tried to align the x-axis direction( imagining some animal fly across the red one of 3 rotate-manipulator circles, that's the direction) to the direction of BEdge, I was confronted with an unexpected direction.
Here is my code:
//after placing rotatePivot, the x-axis direction is vector: (1, 0, 0)
//find the angle to rotate
float $midRot[3] = `angleBetween -euler -v1 1 0 0
-v2 ($edgeDirection.x) ($edgeDirection.y) ($edgeDirection.z)`;
//now rotate it
xform -r -ws -rotateAxis $midRot[0] $midRot[1] $midRot[2] A;
the x-axis direction changed somewhat, but not at all overlapped with direction of BEdge.
I am really confused with this problem, hope someone can help me out,
Thanks in advance!
I have 2 objects(A, B) in my scene.
What i want to do is: rotate A along an edge of B( edge name: BEdge, startingpoint: startP, endpoint: endP).
I had placed rotatePivot of A at the position of startP, and when i tried to align the x-axis direction( imagining some animal fly across the red one of 3 rotate-manipulator circles, that's the direction) to the direction of BEdge, I was confronted with an unexpected direction.
Here is my code:
//after placing rotatePivot, the x-axis direction is vector: (1, 0, 0)
//find the angle to rotate
float $midRot[3] = `angleBetween -euler -v1 1 0 0
-v2 ($edgeDirection.x) ($edgeDirection.y) ($edgeDirection.z)`;
//now rotate it
xform -r -ws -rotateAxis $midRot[0] $midRot[1] $midRot[2] A;
the x-axis direction changed somewhat, but not at all overlapped with direction of BEdge.
I am really confused with this problem, hope someone can help me out,
Thanks in advance!
