On 21/08/2014 at 16:46, xxxxxxxx wrote:
Cinema 4D Version: 14
Platform: Mac OSX ;
Language(s) : PYTHON ;
I have been trying to create a script that would align the object axis (a polygonal object, of course), to a selected axis but keeping all the points in their same absolute positions.
I already have a way to find the points that define the edge.
So, lets say that I have the coordinates of vertex #1 of the edge in variable A and the coordinates of vertex #2 of the edge in variable B.
If I multiply both coordinates by the global matrix of the object, I get their absolute positions.
I can easily move the object to the absolute coordinate A and then move all the points to the difference between their old position and the new position. This way, I can effectively place the axis at the location of point A without changing how the object looks.
But I also want the axis oriented to the direction of the vertex #2.
In a nutshell, I want the object axis to be placed at the location of the vertex #1 and pointing (could be axis Z) to vertex #2. Besides this, I want all the points of the object adjusted so that it seems that only the axis moved and reoriented.
Can anyone help me out?
p.s. This is in python, not in C++