<?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: Python - Change local rotation 1 axis at a time in MotionBuilder Forum</title>
    <link>https://forums.autodesk.com/t5/motionbuilder-forum/python-change-local-rotation-1-axis-at-a-time/m-p/9390192#M2118</link>
    <description>&lt;P&gt;Think this does what you're looking for...&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;from pyfbsdk import *

# Create Cube
myCube = FBModelCube("RotateMe")
myCube.Show = True
# Set random local rotation Vector
myCube.SetVector(FBVector3d(0,14,0), FBModelTransformationType.kModelRotation, False)
# Store current local roation values
lVector = FBVector3d()
myCube.GetVector(lVector, FBModelTransformationType.kModelRotation, False)
# Create new vector
newVector3d = FBVector3d(lVector[0]+0, lVector[1]+90, lVector[2]+0)
# Set new vector
myCube.SetVector(newVector3d, FBModelTransformationType.kModelRotation, False)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 20 Mar 2020 18:17:43 GMT</pubDate>
    <dc:creator>Mocappy</dc:creator>
    <dc:date>2020-03-20T18:17:43Z</dc:date>
    <item>
      <title>Python - Change local rotation 1 axis at a time</title>
      <link>https://forums.autodesk.com/t5/motionbuilder-forum/python-change-local-rotation-1-axis-at-a-time/m-p/7300127#M2115</link>
      <description>&lt;P&gt;I'm a Mobu newbie with Python.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to find a way to just change 1 local rotation axis value. I'm familiar with FBVector3d, but that changes all 3 at the same time. Is there some command that'll do it on a local rotation axis, rather than global?&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2017 22:52:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/motionbuilder-forum/python-change-local-rotation-1-axis-at-a-time/m-p/7300127#M2115</guid>
      <dc:creator>jmalaska</dc:creator>
      <dc:date>2017-08-14T22:52:56Z</dc:date>
    </item>
    <item>
      <title>Re: Python - Change local rotation 1 axis at a time</title>
      <link>https://forums.autodesk.com/t5/motionbuilder-forum/python-change-local-rotation-1-axis-at-a-time/m-p/7313148#M2116</link>
      <description>&lt;P&gt;I think there are two different questions there.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. To only rotate around one axis, use GetVector to get the current values, store them in a variable, then out them straight back in the SetVector, changing only the axis you want to change.&lt;/P&gt;&lt;P&gt;2. To rotate around the local axis, just set the global flag in SetVector to false (check out the docs). Make sure though that you also set the global flag to false in the GetVector or you'll be copying global values back as locals when you use SetVector and that would just be a bit silly.&lt;/P&gt;</description>
      <pubDate>Sat, 19 Aug 2017 15:01:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/motionbuilder-forum/python-change-local-rotation-1-axis-at-a-time/m-p/7313148#M2116</guid>
      <dc:creator>pixerati</dc:creator>
      <dc:date>2017-08-19T15:01:07Z</dc:date>
    </item>
    <item>
      <title>Re: Python - Change local rotation 1 axis at a time</title>
      <link>https://forums.autodesk.com/t5/motionbuilder-forum/python-change-local-rotation-1-axis-at-a-time/m-p/9382009#M2117</link>
      <description>&lt;P&gt;How do you change only the one axis?&lt;BR /&gt;&lt;BR /&gt;For instance if you wanted to rotate the current y axis by 90 degrees how would you go about doing this?&lt;BR /&gt;&lt;BR /&gt;I've tried this:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;lVector = FBVector3d()

mRotationOffset = FBVector3d(0,90,0)

FBSystem().Scene.Evaluate()

#obj.GetVector(lVector,local_translation,False)

obj.GetVector(lVector,local_rotation,False)

Offset = lVector - mRotationOffset


#obj.SetVector(Offset,local_translation, False)

obj.SetVector(Offset,local_rotation, False)&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;This however, doesn't do that same as selecting the object in local and rotating in the Y axis.&amp;nbsp; It's all over the place.&lt;BR /&gt;&lt;BR /&gt;Cheers.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Mar 2020 09:05:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/motionbuilder-forum/python-change-local-rotation-1-axis-at-a-time/m-p/9382009#M2117</guid>
      <dc:creator>petecmartin</dc:creator>
      <dc:date>2020-03-17T09:05:42Z</dc:date>
    </item>
    <item>
      <title>Re: Python - Change local rotation 1 axis at a time</title>
      <link>https://forums.autodesk.com/t5/motionbuilder-forum/python-change-local-rotation-1-axis-at-a-time/m-p/9390192#M2118</link>
      <description>&lt;P&gt;Think this does what you're looking for...&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;from pyfbsdk import *

# Create Cube
myCube = FBModelCube("RotateMe")
myCube.Show = True
# Set random local rotation Vector
myCube.SetVector(FBVector3d(0,14,0), FBModelTransformationType.kModelRotation, False)
# Store current local roation values
lVector = FBVector3d()
myCube.GetVector(lVector, FBModelTransformationType.kModelRotation, False)
# Create new vector
newVector3d = FBVector3d(lVector[0]+0, lVector[1]+90, lVector[2]+0)
# Set new vector
myCube.SetVector(newVector3d, FBModelTransformationType.kModelRotation, False)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Mar 2020 18:17:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/motionbuilder-forum/python-change-local-rotation-1-axis-at-a-time/m-p/9390192#M2118</guid>
      <dc:creator>Mocappy</dc:creator>
      <dc:date>2020-03-20T18:17:43Z</dc:date>
    </item>
    <item>
      <title>Re: Python - Change local rotation 1 axis at a time</title>
      <link>https://forums.autodesk.com/t5/motionbuilder-forum/python-change-local-rotation-1-axis-at-a-time/m-p/9390375#M2119</link>
      <description>&lt;P&gt;Thank you mocappy!&amp;nbsp; I'll give it a whirl &amp;amp; see if it works.&amp;nbsp; Cheers.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Mar 2020 20:04:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/motionbuilder-forum/python-change-local-rotation-1-axis-at-a-time/m-p/9390375#M2119</guid>
      <dc:creator>petecmartin</dc:creator>
      <dc:date>2020-03-20T20:04:50Z</dc:date>
    </item>
    <item>
      <title>Re: Python - Change local rotation 1 axis at a time</title>
      <link>https://forums.autodesk.com/t5/motionbuilder-forum/python-change-local-rotation-1-axis-at-a-time/m-p/9393824#M2120</link>
      <description>&lt;P&gt;Thank you for the feedback Mocappy.&lt;BR /&gt;&lt;BR /&gt;I've tried your method and, sadly, I get the same results as before.&lt;BR /&gt;&lt;BR /&gt;I manage to get around this, however, by: creating two nulls at 0,0,0, then rotating one of them by 90 degrees ; then parent/child constraining the rotated one to the none-rotated one and then zero parent/child constraining the un-rotated null to the object I want.&amp;nbsp; Voila!&lt;BR /&gt;&lt;BR /&gt;It's mad that the local rotation method doesn't&amp;nbsp; want to work how it says on the tin :(.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Mar 2020 14:43:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/motionbuilder-forum/python-change-local-rotation-1-axis-at-a-time/m-p/9393824#M2120</guid>
      <dc:creator>petecmartin</dc:creator>
      <dc:date>2020-03-23T14:43:57Z</dc:date>
    </item>
    <item>
      <title>Re: Python - Change local rotation 1 axis at a time</title>
      <link>https://forums.autodesk.com/t5/motionbuilder-forum/python-change-local-rotation-1-axis-at-a-time/m-p/9396329#M2121</link>
      <description>&lt;P&gt;This method works for me, I just ran Mocappy's script - a few times - and I get the intended result of only the the local y axis being affected.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Mar 2020 12:52:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/motionbuilder-forum/python-change-local-rotation-1-axis-at-a-time/m-p/9396329#M2121</guid>
      <dc:creator>vdebaie</dc:creator>
      <dc:date>2020-03-24T12:52:27Z</dc:date>
    </item>
    <item>
      <title>Re: Python - Change local rotation 1 axis at a time</title>
      <link>https://forums.autodesk.com/t5/motionbuilder-forum/python-change-local-rotation-1-axis-at-a-time/m-p/9396908#M2122</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It looks like it's a gimble thing.&amp;nbsp; My null was aligned to a camera.&amp;nbsp; I then run Mocappy script to just affect the y-axis and it rotates the y but also the x and z?&amp;nbsp; Is it something i'm doing wrong?&lt;/P&gt;</description>
      <pubDate>Tue, 24 Mar 2020 15:31:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/motionbuilder-forum/python-change-local-rotation-1-axis-at-a-time/m-p/9396908#M2122</guid>
      <dc:creator>petecmartin</dc:creator>
      <dc:date>2020-03-24T15:31:08Z</dc:date>
    </item>
    <item>
      <title>Re: Python - Change local rotation 1 axis at a time</title>
      <link>https://forums.autodesk.com/t5/motionbuilder-forum/python-change-local-rotation-1-axis-at-a-time/m-p/9518409#M2123</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You might need to use FBMatrix() for something like this - sorry, didn't realise you have a parent child constraint going on.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I created the same setup as you based on your description: created a camera, a null and a parent/child constraint. Set camera as Source(Parent), and null as Constrained object(Child) - should also work if Null is child of camera in hierarchy.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Run the following script and the null rotates -90 in Y:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;from pyfbsdk import *

# Set Offset Rotation Vector x, y, z
offsetVector3d = FBVector3d(0,-90,0)
# Find 'Null'
null = FBFindModelByLabelName("Null")
# Get Null RotationOrder
nullRotationOrder =  "FBRotationOrder."+str(null.RotationOrder).replace("Euler","")
# Create Empty Matrix for Null
nullMatrix = FBMatrix()
# Get Null Matrix
null.GetMatrix(nullMatrix)
# Create Empty Matrix for Offset
offSetMatrix = FBMatrix()
# Convert 3dVector offset to rotation Matrix
FBRotationToMatrix(offSetMatrix, offsetVector3d, eval(nullRotationOrder))
# Multiply Matrices
nullMatrix *= offSetMatrix
# Set Null Matrix
null.SetMatrix(nullMatrix)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this is&amp;nbsp; more like what you are after,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 May 2020 10:43:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/motionbuilder-forum/python-change-local-rotation-1-axis-at-a-time/m-p/9518409#M2123</guid>
      <dc:creator>Mocappy</dc:creator>
      <dc:date>2020-05-15T10:43:14Z</dc:date>
    </item>
  </channel>
</rss>

