<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Local axis rotation on multiple objects in 3ds Max Modeling Forum</title>
    <link>https://forums.autodesk.com/t5/3ds-max-modeling-forum/local-axis-rotation-on-multiple-objects/m-p/7699384#M12149</link>
    <description>&lt;P&gt;I think the problem is that the lines are create at a skewed orientation.&amp;nbsp; They should be created vertically and then rotated to the correct orientation.&amp;nbsp; Whether they are created natively in Max or imported their pivot orientation will be aligned to the world not to the direction of the line.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let's assume you would like the Z axis of the line to be collinear with the line itself.&amp;nbsp; If you were to create a line in Max that was parallel to the world Z axis then it's pivot Z axis would be aligned with the line.&amp;nbsp; If you were to now rotate that line in 3D then the line's Z pivot would still point in the direction of the line.&amp;nbsp; Now&amp;nbsp;create&amp;nbsp;a Transform Script for the line and you might see something like this:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tt1.JPG" style="width: 705px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/451334i022E1E8455FA1890/image-size/large?v=v2&amp;amp;px=999" role="button" title="tt1.JPG" alt="tt1.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This matrix includes 4 vectors.&amp;nbsp; The third vector is a unit vector in the z direction. The first is a unit vector in the x direction of the object and the second is the unit vector of the pivot's Y direction. Note that these values don't really matter for a line since the line can be rotated about it length by any amount and not really affect its orientation.&amp;nbsp; The fourth vector is the location of the line.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you know the z unit vector that a line should have you can simply copy and paste it to replace the third matrix vector.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What you need is to determine z unit vector&amp;nbsp;of the lines and then use that information along with the position and length to create the line at the rotated orientation.&amp;nbsp; This task is beyond my limited scripting skills but should be straightforward for someone familiar with the process of retrieving line ends with a script and create a line using a matrix.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 18 Jan 2018 03:18:26 GMT</pubDate>
    <dc:creator>leeminardi</dc:creator>
    <dc:date>2018-01-18T03:18:26Z</dc:date>
    <item>
      <title>Local axis rotation on multiple objects</title>
      <link>https://forums.autodesk.com/t5/3ds-max-modeling-forum/local-axis-rotation-on-multiple-objects/m-p/7693036#M12146</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm having problems with a project I'm working on.&amp;nbsp; I've got a series of lines drawn in Rhino that are pointing in various different directions.&amp;nbsp; I've imported the lines as individual splines into 3d Max and everything seems fine (screengrab 001 - top and perspective wireframe view).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to sweep the lines into a box, which is also fine (screengrab 002 - direction of the sweep is fine - end result is how i want them to be orientated).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However when I change the reference coordinate system to local all the line's axis are facing the same direction (screengrab 003 - top view).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any way to have the axis for each object face outwards without having to align it for each object?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Appreciate any suggestions.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screengrab 001" style="width: 705px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/450313iBA8F65F35B219E70/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screengrab 001.jpg" alt="Screengrab 001" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Screengrab 001&lt;/span&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screengrab 002" style="width: 705px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/450314i21CEC84B86B3B111/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screengrab 002.jpg" alt="Screengrab 002" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Screengrab 002&lt;/span&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screengrab 003" style="width: 705px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/450315i163A861D34F846EA/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screengrab 003.jpg" alt="Screengrab 003" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Screengrab 003&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2018 08:30:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-modeling-forum/local-axis-rotation-on-multiple-objects/m-p/7693036#M12146</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-01-16T08:30:11Z</dc:date>
    </item>
    <item>
      <title>Re: Local axis rotation on multiple objects</title>
      <link>https://forums.autodesk.com/t5/3ds-max-modeling-forum/local-axis-rotation-on-multiple-objects/m-p/7695645#M12147</link>
      <description>&lt;P&gt;Shouldn't they have axis' pointing to the direction you want to go anyway, unless the exporter 'reset the xform'?&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2018 23:11:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-modeling-forum/local-axis-rotation-on-multiple-objects/m-p/7695645#M12147</guid>
      <dc:creator>jibijib</dc:creator>
      <dc:date>2018-01-16T23:11:27Z</dc:date>
    </item>
    <item>
      <title>Re: Local axis rotation on multiple objects</title>
      <link>https://forums.autodesk.com/t5/3ds-max-modeling-forum/local-axis-rotation-on-multiple-objects/m-p/7695896#M12148</link>
      <description>&lt;P&gt;Hi jibijib&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks for your reply.&amp;nbsp; Sorry but I'm not sure what you mean by this.&amp;nbsp; I want each individual box to have an axis that moves "out" ("out" based on its own orientation) when you select local in the reference coordinate system.&amp;nbsp; If&amp;nbsp;I xform them all or individually it doesn't change that all the local axis gismos are still facing the same direction.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Hope this makes sense....&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jan 2018 02:09:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-modeling-forum/local-axis-rotation-on-multiple-objects/m-p/7695896#M12148</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-01-17T02:09:50Z</dc:date>
    </item>
    <item>
      <title>Re: Local axis rotation on multiple objects</title>
      <link>https://forums.autodesk.com/t5/3ds-max-modeling-forum/local-axis-rotation-on-multiple-objects/m-p/7699384#M12149</link>
      <description>&lt;P&gt;I think the problem is that the lines are create at a skewed orientation.&amp;nbsp; They should be created vertically and then rotated to the correct orientation.&amp;nbsp; Whether they are created natively in Max or imported their pivot orientation will be aligned to the world not to the direction of the line.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let's assume you would like the Z axis of the line to be collinear with the line itself.&amp;nbsp; If you were to create a line in Max that was parallel to the world Z axis then it's pivot Z axis would be aligned with the line.&amp;nbsp; If you were to now rotate that line in 3D then the line's Z pivot would still point in the direction of the line.&amp;nbsp; Now&amp;nbsp;create&amp;nbsp;a Transform Script for the line and you might see something like this:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tt1.JPG" style="width: 705px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/451334i022E1E8455FA1890/image-size/large?v=v2&amp;amp;px=999" role="button" title="tt1.JPG" alt="tt1.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This matrix includes 4 vectors.&amp;nbsp; The third vector is a unit vector in the z direction. The first is a unit vector in the x direction of the object and the second is the unit vector of the pivot's Y direction. Note that these values don't really matter for a line since the line can be rotated about it length by any amount and not really affect its orientation.&amp;nbsp; The fourth vector is the location of the line.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you know the z unit vector that a line should have you can simply copy and paste it to replace the third matrix vector.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What you need is to determine z unit vector&amp;nbsp;of the lines and then use that information along with the position and length to create the line at the rotated orientation.&amp;nbsp; This task is beyond my limited scripting skills but should be straightforward for someone familiar with the process of retrieving line ends with a script and create a line using a matrix.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jan 2018 03:18:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-modeling-forum/local-axis-rotation-on-multiple-objects/m-p/7699384#M12149</guid>
      <dc:creator>leeminardi</dc:creator>
      <dc:date>2018-01-18T03:18:26Z</dc:date>
    </item>
    <item>
      <title>Re: Local axis rotation on multiple objects</title>
      <link>https://forums.autodesk.com/t5/3ds-max-modeling-forum/local-axis-rotation-on-multiple-objects/m-p/7699417#M12150</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN&gt;lee.minardi,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks for your reply.&amp;nbsp; I have to be honest - I have very little understanding of scripting&amp;nbsp;(waaaaaaaay less than you i'm guessing).&amp;nbsp; I kind of thought that the solution would be something along those lines as the information for the rotation of the local axis seemed lost on import.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I actually managed to sort it out this morning by searching the internet for a few days - &lt;A href="fn RotatePivotOnly obj index= ( rot = (matrixFromNormal (polyop.getFaceNormal obj index)*obj.transform ) as quat rotValInv=inverse rot animate off in coordsys local obj.rotation*=RotValInv obj.objectoffsetrot*=RotValInv obj.objectoffsetpos*=RotValInv ) for a in selection do ( setrefCoordSys #local CenterPivot a theNormal=polyop.getFaceNormal a 1 RotatePivotOnly a 1 )" target="_blank"&gt;https://www.youtube.com/watch?v=gLyhlkjN7ik&amp;amp;feature=youtu.be&lt;/A&gt;&amp;nbsp;- this video had a similar problem and the user inputted the below script.&amp;nbsp; It only works with single faced editable polys - but i just extruded each spline a little way and collapsed them to use the script.&amp;nbsp; Works pretty well and I have no idea how it works &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp; Something for me to learn when I'm not busy I guess &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Align local axis to Single face script:&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;fn RotatePivotOnly obj index=&lt;BR /&gt;(&lt;BR /&gt;rot = (matrixFromNormal (polyop.getFaceNormal obj index)*obj.transform ) as quat&lt;BR /&gt;rotValInv=inverse rot&lt;BR /&gt;animate off in coordsys local obj.rotation*=RotValInv&lt;BR /&gt;obj.objectoffsetrot*=RotValInv&lt;BR /&gt;obj.objectoffsetpos*=RotValInv&lt;BR /&gt;)&lt;BR /&gt;for a in selection do&lt;BR /&gt;(&lt;BR /&gt;setrefCoordSys #local&lt;BR /&gt;CenterPivot a&lt;BR /&gt;theNormal=polyop.getFaceNormal a 1&lt;BR /&gt;RotatePivotOnly a 1&lt;BR /&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Many thanks again for taking the time to reply!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jan 2018 03:47:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-modeling-forum/local-axis-rotation-on-multiple-objects/m-p/7699417#M12150</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-01-18T03:47:09Z</dc:date>
    </item>
    <item>
      <title>Re: Local axis rotation on multiple objects</title>
      <link>https://forums.autodesk.com/t5/3ds-max-modeling-forum/local-axis-rotation-on-multiple-objects/m-p/7702395#M12151</link>
      <description>&lt;P&gt;This has been a good project to teach myself a bit about Max scripts.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have been successful in writing a script that will align the&amp;nbsp; Z axis of the pivot to a line.&amp;nbsp; That is, it will align the pivot z-axis to the first two vertices of a spline.&amp;nbsp; When I have a little more time I will modify it to operate on all selected splines.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;spl = selection[1]
s = 1	
e1 = getKnotPoint spl s 1 
e2 = getKnotPoint spl s 2
mid12 = (e1+e2)/2
v = e2-e1
vlen = length(v)
vu = v/vlen
m = spl.transform
ftm = translate (matrixfromnormal vu) mid12
itm = ftm*(inverse m)
spl.transform = ftm
spl.objectOffsetPos *= inverse itm
spl.objectOffsetRot *= inverse itm.rotation
spl.transform
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jan 2018 23:25:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-modeling-forum/local-axis-rotation-on-multiple-objects/m-p/7702395#M12151</guid>
      <dc:creator>leeminardi</dc:creator>
      <dc:date>2018-01-18T23:25:42Z</dc:date>
    </item>
    <item>
      <title>Re: Local axis rotation on multiple objects</title>
      <link>https://forums.autodesk.com/t5/3ds-max-modeling-forum/local-axis-rotation-on-multiple-objects/m-p/7705455#M12152</link>
      <description>&lt;P&gt;This version of the Maxscript will work on a selection of objects but will only change the pivot of lines.&lt;/P&gt;
&lt;PRE&gt;-- modifies the pivot of selected lines so that the pivot is located at the midpoint &lt;BR /&gt;-- of the line and the pivot's Z axis is aligned with the line.
for spl in selection where classof spl == line do (
s=1
e1 = getKnotPoint spl s 1 
e2 = getKnotPoint spl s 2
mid12 = (e1+e2)/2
v = e2-e1  -- vector from vertex 1 to 2
vlen = length(v)
vu = v/vlen  -- unit vector
m = spl.transform  -- spline matrix
ftm = translate (matrixfromnormal vu) mid12
itm = ftm*(inverse m)
spl.transform = ftm
spl.objectOffsetPos *= inverse itm
spl.objectOffsetRot *= inverse itm.rotation
spl.transform
)&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jan 2018 23:43:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-modeling-forum/local-axis-rotation-on-multiple-objects/m-p/7705455#M12152</guid>
      <dc:creator>leeminardi</dc:creator>
      <dc:date>2018-01-19T23:43:50Z</dc:date>
    </item>
  </channel>
</rss>

