<?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 How to Modify VR HMD/Camera Postitions with Python in VRED Forum</title>
    <link>https://forums.autodesk.com/t5/vred-forum/how-to-modify-vr-hmd-camera-postitions-with-python/m-p/9014682#M5199</link>
    <description>&lt;P&gt;&lt;SPAN style="margin: 0px; line-height: 107%; font-size: 12pt;"&gt;&lt;FONT face="Calibri" color="#000000"&gt;Hi All,&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="margin: 0px; line-height: 107%; font-size: 12pt;"&gt;&lt;FONT face="Calibri" color="#000000"&gt;I'm hoping to get a better understanding on how to adjust the camera position of the VR headset. For example, if I was looking to move the VR view up a set number of units I know if can use:&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN style="margin: 0px; line-height: 107%; font-size: 12pt;"&gt;&lt;FONT face="Calibri" color="#000000"&gt;getActiveCameraNode().getWorldTransform() – to get the camera position matrix/list with x,y,z being values 3, 7 and 11 in the list&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="margin: 0px; line-height: 107%; font-size: 12pt;"&gt;&lt;FONT face="Calibri" color="#000000"&gt;getActiveCameraNode().setTranslation(matrix[3],matrix[7],z+1000) – to modify the position of the camera node&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;SPAN style="margin: 0px; line-height: 107%; font-size: 12pt;"&gt;&lt;FONT face="Calibri" color="#000000"&gt;However, in this process the VR view tends to rotate, with the amount of rotation depending on where the VR is looking (this is a bit hard to explain). I can mitigate this by using getWorldRotation() before performing the translation, and using setRotation() after the translation to put the camera back. Unfortunately doing this creates a few frames of the rotation changing and makes the action uncomfortable to look at.&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="margin: 0px; line-height: 107%; font-size: 12pt;"&gt;&lt;FONT face="Calibri" color="#000000"&gt;I then started to look at setTranformMatrix(), but I clearly don’t understand how this function works. Using the code below, I get different matrices before and after the setTransformMatrix(), despite not doing anything to the matrix/list. &lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="margin: 0px; line-height: 107%; font-size: 12pt;"&gt;&lt;FONT face="Calibri" color="#000000"&gt;matrix = &lt;SPAN style="background-color: transparent; box-sizing: border-box; color: #666666; font-family: &amp;amp;quot; artifakt&amp;amp;quot;,tahoma,helvetica,arial,sans-serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 17.33px; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px; margin: 0px;"&gt;&lt;FONT face="Calibri" color="#000000"&gt;getActiveCameraNode()&lt;/FONT&gt;&lt;/SPAN&gt;.getWorldTransform()&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="margin: 0px; line-height: 107%; font-size: 12pt;"&gt;&lt;FONT face="Calibri" color="#000000"&gt;print(matrix)&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: transparent; box-sizing: border-box; color: #666666; font-family: &amp;amp;quot; artifakt&amp;amp;quot;,tahoma,helvetica,arial,sans-serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 17.33px; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px; margin: 0px;"&gt;&lt;FONT face="Calibri" color="#000000"&gt;getActiveCameraNode()&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="margin: 0px; line-height: 107%; font-size: 12pt;"&gt;&lt;FONT face="Calibri" color="#000000"&gt;.setTransformMatrix(matrix, false)&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="margin: 0px; line-height: 107%; font-size: 12pt;"&gt;&lt;FONT face="Calibri" color="#000000"&gt;print(&lt;SPAN style="background-color: transparent; box-sizing: border-box; color: #666666; font-family: &amp;amp;quot; artifakt&amp;amp;quot;,tahoma,helvetica,arial,sans-serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 17.33px; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px; margin: 0px;"&gt;&lt;FONT face="Calibri" color="#000000"&gt;getActiveCameraNode()&lt;/FONT&gt;&lt;/SPAN&gt;.getWorldTransform())&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="margin: 0px; line-height: 107%; font-size: 12pt;"&gt;&lt;FONT face="Calibri" color="#000000"&gt;On the surface setTransformMatrix() seems like what I would want as it (I think) it allows the setting of both translation and rotation at the same time.&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="margin: 0px; line-height: 107%; font-size: 12pt;"&gt;&lt;FONT face="Calibri" color="#000000"&gt;Can anybody help clear up the best way to move the VR camera around without the rotation problem listed above?&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="margin: 0px; line-height: 107%; font-size: 12pt;"&gt;&lt;FONT face="Calibri" color="#000000"&gt;Thanks!&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 09 Sep 2019 18:22:12 GMT</pubDate>
    <dc:creator>daniel.jeffery</dc:creator>
    <dc:date>2019-09-09T18:22:12Z</dc:date>
    <item>
      <title>How to Modify VR HMD/Camera Postitions with Python</title>
      <link>https://forums.autodesk.com/t5/vred-forum/how-to-modify-vr-hmd-camera-postitions-with-python/m-p/9014682#M5199</link>
      <description>&lt;P&gt;&lt;SPAN style="margin: 0px; line-height: 107%; font-size: 12pt;"&gt;&lt;FONT face="Calibri" color="#000000"&gt;Hi All,&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="margin: 0px; line-height: 107%; font-size: 12pt;"&gt;&lt;FONT face="Calibri" color="#000000"&gt;I'm hoping to get a better understanding on how to adjust the camera position of the VR headset. For example, if I was looking to move the VR view up a set number of units I know if can use:&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN style="margin: 0px; line-height: 107%; font-size: 12pt;"&gt;&lt;FONT face="Calibri" color="#000000"&gt;getActiveCameraNode().getWorldTransform() – to get the camera position matrix/list with x,y,z being values 3, 7 and 11 in the list&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="margin: 0px; line-height: 107%; font-size: 12pt;"&gt;&lt;FONT face="Calibri" color="#000000"&gt;getActiveCameraNode().setTranslation(matrix[3],matrix[7],z+1000) – to modify the position of the camera node&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;SPAN style="margin: 0px; line-height: 107%; font-size: 12pt;"&gt;&lt;FONT face="Calibri" color="#000000"&gt;However, in this process the VR view tends to rotate, with the amount of rotation depending on where the VR is looking (this is a bit hard to explain). I can mitigate this by using getWorldRotation() before performing the translation, and using setRotation() after the translation to put the camera back. Unfortunately doing this creates a few frames of the rotation changing and makes the action uncomfortable to look at.&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="margin: 0px; line-height: 107%; font-size: 12pt;"&gt;&lt;FONT face="Calibri" color="#000000"&gt;I then started to look at setTranformMatrix(), but I clearly don’t understand how this function works. Using the code below, I get different matrices before and after the setTransformMatrix(), despite not doing anything to the matrix/list. &lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="margin: 0px; line-height: 107%; font-size: 12pt;"&gt;&lt;FONT face="Calibri" color="#000000"&gt;matrix = &lt;SPAN style="background-color: transparent; box-sizing: border-box; color: #666666; font-family: &amp;amp;quot; artifakt&amp;amp;quot;,tahoma,helvetica,arial,sans-serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 17.33px; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px; margin: 0px;"&gt;&lt;FONT face="Calibri" color="#000000"&gt;getActiveCameraNode()&lt;/FONT&gt;&lt;/SPAN&gt;.getWorldTransform()&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="margin: 0px; line-height: 107%; font-size: 12pt;"&gt;&lt;FONT face="Calibri" color="#000000"&gt;print(matrix)&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: transparent; box-sizing: border-box; color: #666666; font-family: &amp;amp;quot; artifakt&amp;amp;quot;,tahoma,helvetica,arial,sans-serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 17.33px; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px; margin: 0px;"&gt;&lt;FONT face="Calibri" color="#000000"&gt;getActiveCameraNode()&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="margin: 0px; line-height: 107%; font-size: 12pt;"&gt;&lt;FONT face="Calibri" color="#000000"&gt;.setTransformMatrix(matrix, false)&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="margin: 0px; line-height: 107%; font-size: 12pt;"&gt;&lt;FONT face="Calibri" color="#000000"&gt;print(&lt;SPAN style="background-color: transparent; box-sizing: border-box; color: #666666; font-family: &amp;amp;quot; artifakt&amp;amp;quot;,tahoma,helvetica,arial,sans-serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 17.33px; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px; margin: 0px;"&gt;&lt;FONT face="Calibri" color="#000000"&gt;getActiveCameraNode()&lt;/FONT&gt;&lt;/SPAN&gt;.getWorldTransform())&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="margin: 0px; line-height: 107%; font-size: 12pt;"&gt;&lt;FONT face="Calibri" color="#000000"&gt;On the surface setTransformMatrix() seems like what I would want as it (I think) it allows the setting of both translation and rotation at the same time.&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="margin: 0px; line-height: 107%; font-size: 12pt;"&gt;&lt;FONT face="Calibri" color="#000000"&gt;Can anybody help clear up the best way to move the VR camera around without the rotation problem listed above?&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="margin: 0px; line-height: 107%; font-size: 12pt;"&gt;&lt;FONT face="Calibri" color="#000000"&gt;Thanks!&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Sep 2019 18:22:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vred-forum/how-to-modify-vr-hmd-camera-postitions-with-python/m-p/9014682#M5199</guid>
      <dc:creator>daniel.jeffery</dc:creator>
      <dc:date>2019-09-09T18:22:12Z</dc:date>
    </item>
  </channel>
</rss>

