View Full Version : Rotate along edge

03 March 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!

03 March 2009, 02:39 PM
Can you post a picture of what you're trying to do? It's not very clear from the thread what went wrong.

03 March 2009, 02:01 AM
Thanks for reminding me.

This is my scene:
Attach Files: scene_DesinyObj.JPG

Object A and C are grouped as group1(the 2 objects on the left).
The object showing its vertex number on is my destiny object.
I have placed rotatePivot of group1 at the position of vtx[6] of the destiny object.

What i want to do is:
Align local rotate x-axis of group1 with this edge:( vtx[6]->vtx[4])

The ideal result looks like:
Attach Files: scene_showRotateManipulator.JPG

and this picture(showing local rotating axis on)
Attach Files: scene_LocaAxisOfGroup1.JPG

Thank you!

03 March 2009, 08:27 AM
have you tryed Henry Korols Local tools (

03 March 2009, 08:51 AM
The manipulators in the last two images look identical, or am I missing something obvious!?

03 March 2009, 04:29 PM
yes, manipulators in the last two pictures are identical,
I was trying to illustrate my thought in two ways.

And thanks for your information, ewerybody,
Busy now, but I will try this tool out. At this moment it looks promising for me.

CGTalk Moderation
03 March 2009, 04:29 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.