<?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 Draw surrogates 'wobbly' at high speeds when location set before rotation in FlexSim Forum</title>
    <link>https://forums.autodesk.com/t5/flexsim-forum/draw-surrogates-wobbly-at-high-speeds-when-location-set-before/m-p/13517315#M28994</link>
    <description>&lt;P&gt;&lt;I&gt;[ FlexSim 22.0.4 ]&lt;/I&gt;&lt;/P&gt;&lt;DIV class="fr-view clearfix"&gt;&lt;P&gt;OK so this is a bit of a weird issue and I already know the solution, but I am curious about the explanation. &lt;/P&gt;&lt;P&gt;I simplified the following model from a more complex object which tries to update the position of its drawsurrogates in the &lt;EM&gt;OnPreDraw&lt;/EM&gt; event. It calculates a new position and rotation, then sets&lt;/P&gt;&lt;PRE&gt;box.setLocation( x, y, z, 0, 0.5, 0 );
box.setRotation( 0, 0, 90 - angle ); &amp;nbsp; &amp;nbsp;&lt;/PRE&gt;&lt;P&gt;At low run speeds, this works fine, but if you crank the speed up to, say, 16,000x you will see the animation go all jumpy or the circle become wobbly.&lt;/P&gt;&lt;P&gt;What really surprised me (you won't believe it! read it now!) is: when I swapped the order of the setLocation and setRotation statements, everything works smoothly for me... at all run speeds.&lt;/P&gt;&lt;P&gt;Note that this only works in combination with the &lt;EM&gt;setLocation &lt;/EM&gt;using non-zero factors, so I guess it's related to that... but then I thought that this behavior would maybe change if I changed the &lt;EM&gt;centroid &lt;/EM&gt;property of the boxes which it doesn't seem to.&lt;/P&gt;&lt;P&gt;Here is the demo model to try it out: &lt;A rel="noopener noreferrer" href="https://answers.flexsim.com/storage/attachments/53272-boxpredrawtest.fsm" target="_blank"&gt;BoxPreDrawTest.fsm&lt;/A&gt;&lt;/P&gt;&lt;/DIV&gt;</description>
    <pubDate>Thu, 09 Jun 2022 14:53:58 GMT</pubDate>
    <dc:creator>mischa_spelt</dc:creator>
    <dc:date>2022-06-09T14:53:58Z</dc:date>
    <item>
      <title>Draw surrogates 'wobbly' at high speeds when location set before rotation</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/draw-surrogates-wobbly-at-high-speeds-when-location-set-before/m-p/13517315#M28994</link>
      <description>&lt;P&gt;&lt;I&gt;[ FlexSim 22.0.4 ]&lt;/I&gt;&lt;/P&gt;&lt;DIV class="fr-view clearfix"&gt;&lt;P&gt;OK so this is a bit of a weird issue and I already know the solution, but I am curious about the explanation. &lt;/P&gt;&lt;P&gt;I simplified the following model from a more complex object which tries to update the position of its drawsurrogates in the &lt;EM&gt;OnPreDraw&lt;/EM&gt; event. It calculates a new position and rotation, then sets&lt;/P&gt;&lt;PRE&gt;box.setLocation( x, y, z, 0, 0.5, 0 );
box.setRotation( 0, 0, 90 - angle ); &amp;nbsp; &amp;nbsp;&lt;/PRE&gt;&lt;P&gt;At low run speeds, this works fine, but if you crank the speed up to, say, 16,000x you will see the animation go all jumpy or the circle become wobbly.&lt;/P&gt;&lt;P&gt;What really surprised me (you won't believe it! read it now!) is: when I swapped the order of the setLocation and setRotation statements, everything works smoothly for me... at all run speeds.&lt;/P&gt;&lt;P&gt;Note that this only works in combination with the &lt;EM&gt;setLocation &lt;/EM&gt;using non-zero factors, so I guess it's related to that... but then I thought that this behavior would maybe change if I changed the &lt;EM&gt;centroid &lt;/EM&gt;property of the boxes which it doesn't seem to.&lt;/P&gt;&lt;P&gt;Here is the demo model to try it out: &lt;A rel="noopener noreferrer" href="https://answers.flexsim.com/storage/attachments/53272-boxpredrawtest.fsm" target="_blank"&gt;BoxPreDrawTest.fsm&lt;/A&gt;&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 09 Jun 2022 14:53:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/draw-surrogates-wobbly-at-high-speeds-when-location-set-before/m-p/13517315#M28994</guid>
      <dc:creator>mischa_spelt</dc:creator>
      <dc:date>2022-06-09T14:53:58Z</dc:date>
    </item>
    <item>
      <title>Re: Draw surrogates 'wobbly' at high speeds when location set before rotation</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/draw-surrogates-wobbly-at-high-speeds-when-location-set-before/m-p/13517316#M28995</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;&lt;P&gt;The boxes in your attached model are using a shape that isn't packed into the model, so we can't see what you are talking about using the model you attached:&lt;/P&gt;&lt;P style="margin: 0px 0px 10px; color: rgb(65, 65, 65); font-family: sans-serif; font-size: 15px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="1654814702165.png"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1510736i7418EBAC6515168F/image-size/large?v=v2&amp;amp;px=999" role="button" title="1654814702165.png" alt="1654814702165.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Even without replicating the issue in your model though, it is easy to explain what's happening.&lt;/P&gt;&lt;P&gt;When you set a location using factors, then the rotation of the object affects the position that it will be set to. In your example code, you are setting the center of the bottom left edge of the object to a particular location. That point of the object represents a different absolute location in space based on the object's rotation.&lt;/P&gt;&lt;P style="margin: 0px 0px 10px; color: rgb(65, 65, 65); font-family: sans-serif; font-size: 15px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="1654815713124.png"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1510735iA80A6B1BE9423502/image-size/large?v=v2&amp;amp;px=999" role="button" title="1654815713124.png" alt="1654815713124.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;If you are setting the location first and then the rotation, then the location's position will be based on the rotation that the object was during the previous call, which will vary by run speed. Longer run speeds will have more time between frames.&lt;/P&gt;&lt;P&gt;Attached is a simplified sample model that can help explain.&lt;/P&gt;&lt;P style="margin: 0px 0px 10px; color: rgb(65, 65, 65); font-family: sans-serif; font-size: 15px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"&gt;&lt;A rel="noopener noreferrer" href="https://answers.flexsim.com/storage/attachments/53291-location-factors.fsm" target="_blank"&gt;location_factors.fsm&lt;/A&gt;&lt;/P&gt;&lt;P style="margin: 0px 0px 10px; color: rgb(65, 65, 65); font-family: sans-serif; font-size: 15px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="1654815264769.png"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1510737i737CB58BA969975F/image-size/large?v=v2&amp;amp;px=999" role="button" title="1654815264769.png" alt="1654815264769.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;If you execute the top scripts multiple times, each script always puts the box into the same absolute position.&lt;/P&gt;&lt;P&gt;If you execute the bottom scripts multiple times, then the first execution of the script may put the box into a different absolute position depending on what the box's last rotation was before you executed the script.&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 09 Jun 2022 23:05:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/draw-surrogates-wobbly-at-high-speeds-when-location-set-before/m-p/13517316#M28995</guid>
      <dc:creator>philboboADSK</dc:creator>
      <dc:date>2022-06-09T23:05:47Z</dc:date>
    </item>
    <item>
      <title>Re: Draw surrogates 'wobbly' at high speeds when location set before rotation</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/draw-surrogates-wobbly-at-high-speeds-when-location-set-before/m-p/13517317#M28996</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;&lt;P&gt;In addition to the picture above, here's another picture with more explanation:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="1654816958102.png"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1510739i1490E3576016C07E/image-size/large?v=v2&amp;amp;px=999" role="button" title="1654816958102.png" alt="1654816958102.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 09 Jun 2022 23:19:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/draw-surrogates-wobbly-at-high-speeds-when-location-set-before/m-p/13517317#M28996</guid>
      <dc:creator>philboboADSK</dc:creator>
      <dc:date>2022-06-09T23:19:15Z</dc:date>
    </item>
    <item>
      <title>Re: Draw surrogates 'wobbly' at high speeds when location set before rotation</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/draw-surrogates-wobbly-at-high-speeds-when-location-set-before/m-p/13517318#M28997</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;it is easy to explain what's happening. &lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Once you see it, it's easy &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; Thanks!&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 13 Jun 2022 07:30:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/draw-surrogates-wobbly-at-high-speeds-when-location-set-before/m-p/13517318#M28997</guid>
      <dc:creator>mischa_spelt</dc:creator>
      <dc:date>2022-06-13T07:30:55Z</dc:date>
    </item>
  </channel>
</rss>

