{"id":225,"date":"2024-03-21T08:18:16","date_gmt":"2024-03-21T08:18:16","guid":{"rendered":"https:\/\/tensor.agenthub.uk\/?p=225"},"modified":"2024-04-24T08:43:16","modified_gmt":"2024-04-24T08:43:16","slug":"physics-simulate","status":"publish","type":"post","link":"https:\/\/tensorzen.online\/?p=225","title":{"rendered":"Fixed update with Physics.Simulate in Unity"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">When we set &#8216;Physics.simulationMode&#8217;  to &#8216;Script&#8217;, we can manually control the fixed update using &#8216;Physics.Simulate&#8217;. Here, we observe the differences when &#8216;Physics.simulationMode&#8217; is placed at the top or bottom of the &#8216;FixedUpdate()&#8217; function.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">First time:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.75rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#f6f6f4;--cbp-line-number-width:calc(2 * 0.6 * .75rem);line-height:1rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#282A36\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"private void Awake()\n{\n    Physics.simulationMode = SimulationMode.Script;\n}\n\nprivate void FixedUpdate()\n{\n    Debug.Log($&quot;{this.transform.position.y}&quot;);\n    Physics.Simulate(Time.fixedDeltaTime);\n}\" style=\"color:#f6f6f4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dracula-soft\" style=\"background-color: #282A36\" tabindex=\"0\"><code class=\"\" data-line=\"\">&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #F286C4&quot;&gt;private&lt;\/span&gt;&lt;span style=&quot;color: #F6F6F4&quot;&gt; &lt;\/span&gt;&lt;span style=&quot;color: #F286C4&quot;&gt;void&lt;\/span&gt;&lt;span style=&quot;color: #F6F6F4&quot;&gt; &lt;\/span&gt;&lt;span style=&quot;color: #62E884&quot;&gt;Awake&lt;\/span&gt;&lt;span style=&quot;color: #F6F6F4&quot;&gt;()&lt;\/span&gt;&lt;\/span&gt;\n&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #F6F6F4&quot;&gt;{&lt;\/span&gt;&lt;\/span&gt;\n&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #F6F6F4&quot;&gt;    Physics.simulationMode &lt;\/span&gt;&lt;span style=&quot;color: #F286C4&quot;&gt;=&lt;\/span&gt;&lt;span style=&quot;color: #F6F6F4&quot;&gt; SimulationMode.Script;&lt;\/span&gt;&lt;\/span&gt;\n&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #F6F6F4&quot;&gt;}&lt;\/span&gt;&lt;\/span&gt;\n&lt;span class=&quot;line&quot;&gt;&lt;\/span&gt;\n&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #F286C4&quot;&gt;private&lt;\/span&gt;&lt;span style=&quot;color: #F6F6F4&quot;&gt; &lt;\/span&gt;&lt;span style=&quot;color: #F286C4&quot;&gt;void&lt;\/span&gt;&lt;span style=&quot;color: #F6F6F4&quot;&gt; &lt;\/span&gt;&lt;span style=&quot;color: #62E884&quot;&gt;FixedUpdate&lt;\/span&gt;&lt;span style=&quot;color: #F6F6F4&quot;&gt;()&lt;\/span&gt;&lt;\/span&gt;\n&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #F6F6F4&quot;&gt;{&lt;\/span&gt;&lt;\/span&gt;\n&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #F6F6F4&quot;&gt;    Debug.&lt;\/span&gt;&lt;span style=&quot;color: #62E884&quot;&gt;Log&lt;\/span&gt;&lt;span style=&quot;color: #F6F6F4&quot;&gt;(&lt;\/span&gt;&lt;span style=&quot;color: #DEE492&quot;&gt;$&quot;&lt;\/span&gt;&lt;span style=&quot;color: #F286C4&quot;&gt;{&lt;\/span&gt;&lt;span style=&quot;color: #BF9EEE; font-style: italic&quot;&gt;this&lt;\/span&gt;&lt;span style=&quot;color: #E7EE98&quot;&gt;.&lt;\/span&gt;&lt;span style=&quot;color: #F6F6F4&quot;&gt;transform&lt;\/span&gt;&lt;span style=&quot;color: #E7EE98&quot;&gt;.&lt;\/span&gt;&lt;span style=&quot;color: #F6F6F4&quot;&gt;position&lt;\/span&gt;&lt;span style=&quot;color: #E7EE98&quot;&gt;.&lt;\/span&gt;&lt;span style=&quot;color: #F6F6F4&quot;&gt;y&lt;\/span&gt;&lt;span style=&quot;color: #F286C4&quot;&gt;}&lt;\/span&gt;&lt;span style=&quot;color: #DEE492&quot;&gt;&quot;&lt;\/span&gt;&lt;span style=&quot;color: #F6F6F4&quot;&gt;);&lt;\/span&gt;&lt;\/span&gt;\n&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #F6F6F4&quot;&gt;    Physics.&lt;\/span&gt;&lt;span style=&quot;color: #62E884&quot;&gt;Simulate&lt;\/span&gt;&lt;span style=&quot;color: #F6F6F4&quot;&gt;(Time.fixedDeltaTime);&lt;\/span&gt;&lt;\/span&gt;\n&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #F6F6F4&quot;&gt;}&lt;\/span&gt;&lt;\/span&gt;<\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">output:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.75rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#f6f6f4;--cbp-line-number-width:calc(2 * 0.6 * .75rem);line-height:1rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#282A36\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"10\n9.996076\n9.988228\n9.976456\n9.96076\n9.94114\n9.917596\n9.890128\n9.858736\n9.82342\n9.78418\n9.741015\n9.693928\n9.642916\n9.587979\n9.529119\n9.466335\n9.399628\n9.328996\n9.254439\" style=\"color:#f6f6f4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dracula-soft\" style=\"background-color: #282A36\" tabindex=\"0\"><code class=\"\" data-line=\"\">&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #BF9EEE&quot;&gt;10&lt;\/span&gt;&lt;\/span&gt;\n&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #BF9EEE&quot;&gt;9.996076&lt;\/span&gt;&lt;\/span&gt;\n&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #BF9EEE&quot;&gt;9.988228&lt;\/span&gt;&lt;\/span&gt;\n&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #BF9EEE&quot;&gt;9.976456&lt;\/span&gt;&lt;\/span&gt;\n&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #BF9EEE&quot;&gt;9.96076&lt;\/span&gt;&lt;\/span&gt;\n&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #BF9EEE&quot;&gt;9.94114&lt;\/span&gt;&lt;\/span&gt;\n&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #BF9EEE&quot;&gt;9.917596&lt;\/span&gt;&lt;\/span&gt;\n&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #BF9EEE&quot;&gt;9.890128&lt;\/span&gt;&lt;\/span&gt;\n&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #BF9EEE&quot;&gt;9.858736&lt;\/span&gt;&lt;\/span&gt;\n&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #BF9EEE&quot;&gt;9.82342&lt;\/span&gt;&lt;\/span&gt;\n&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #BF9EEE&quot;&gt;9.78418&lt;\/span&gt;&lt;\/span&gt;\n&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #BF9EEE&quot;&gt;9.741015&lt;\/span&gt;&lt;\/span&gt;\n&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #BF9EEE&quot;&gt;9.693928&lt;\/span&gt;&lt;\/span&gt;\n&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #BF9EEE&quot;&gt;9.642916&lt;\/span&gt;&lt;\/span&gt;\n&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #BF9EEE&quot;&gt;9.587979&lt;\/span&gt;&lt;\/span&gt;\n&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #BF9EEE&quot;&gt;9.529119&lt;\/span&gt;&lt;\/span&gt;\n&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #BF9EEE&quot;&gt;9.466335&lt;\/span&gt;&lt;\/span&gt;\n&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #BF9EEE&quot;&gt;9.399628&lt;\/span&gt;&lt;\/span&gt;\n&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #BF9EEE&quot;&gt;9.328996&lt;\/span&gt;&lt;\/span&gt;\n&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #BF9EEE&quot;&gt;9.254439&lt;\/span&gt;&lt;\/span&gt;<\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Second time:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.75rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#f6f6f4;--cbp-line-number-width:calc(2 * 0.6 * .75rem);line-height:1rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#282A36\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"private void Awake()\n{\n    Physics.simulationMode = SimulationMode.Script;\n}\n\nprivate void FixedUpdate()\n{\n    Physics.Simulate(Time.fixedDeltaTime);\n    Debug.Log($&quot;{this.transform.position.y}&quot;);\n}\" style=\"color:#f6f6f4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dracula-soft\" style=\"background-color: #282A36\" tabindex=\"0\"><code class=\"\" data-line=\"\">&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #F286C4&quot;&gt;private&lt;\/span&gt;&lt;span style=&quot;color: #F6F6F4&quot;&gt; &lt;\/span&gt;&lt;span style=&quot;color: #F286C4&quot;&gt;void&lt;\/span&gt;&lt;span style=&quot;color: #F6F6F4&quot;&gt; &lt;\/span&gt;&lt;span style=&quot;color: #62E884&quot;&gt;Awake&lt;\/span&gt;&lt;span style=&quot;color: #F6F6F4&quot;&gt;()&lt;\/span&gt;&lt;\/span&gt;\n&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #F6F6F4&quot;&gt;{&lt;\/span&gt;&lt;\/span&gt;\n&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #F6F6F4&quot;&gt;    Physics.simulationMode &lt;\/span&gt;&lt;span style=&quot;color: #F286C4&quot;&gt;=&lt;\/span&gt;&lt;span style=&quot;color: #F6F6F4&quot;&gt; SimulationMode.Script;&lt;\/span&gt;&lt;\/span&gt;\n&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #F6F6F4&quot;&gt;}&lt;\/span&gt;&lt;\/span&gt;\n&lt;span class=&quot;line&quot;&gt;&lt;\/span&gt;\n&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #F286C4&quot;&gt;private&lt;\/span&gt;&lt;span style=&quot;color: #F6F6F4&quot;&gt; &lt;\/span&gt;&lt;span style=&quot;color: #F286C4&quot;&gt;void&lt;\/span&gt;&lt;span style=&quot;color: #F6F6F4&quot;&gt; &lt;\/span&gt;&lt;span style=&quot;color: #62E884&quot;&gt;FixedUpdate&lt;\/span&gt;&lt;span style=&quot;color: #F6F6F4&quot;&gt;()&lt;\/span&gt;&lt;\/span&gt;\n&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #F6F6F4&quot;&gt;{&lt;\/span&gt;&lt;\/span&gt;\n&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #F6F6F4&quot;&gt;    Physics.&lt;\/span&gt;&lt;span style=&quot;color: #62E884&quot;&gt;Simulate&lt;\/span&gt;&lt;span style=&quot;color: #F6F6F4&quot;&gt;(Time.fixedDeltaTime);&lt;\/span&gt;&lt;\/span&gt;\n&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #F6F6F4&quot;&gt;    Debug.&lt;\/span&gt;&lt;span style=&quot;color: #62E884&quot;&gt;Log&lt;\/span&gt;&lt;span style=&quot;color: #F6F6F4&quot;&gt;(&lt;\/span&gt;&lt;span style=&quot;color: #DEE492&quot;&gt;$&quot;&lt;\/span&gt;&lt;span style=&quot;color: #F286C4&quot;&gt;{&lt;\/span&gt;&lt;span style=&quot;color: #BF9EEE; font-style: italic&quot;&gt;this&lt;\/span&gt;&lt;span style=&quot;color: #E7EE98&quot;&gt;.&lt;\/span&gt;&lt;span style=&quot;color: #F6F6F4&quot;&gt;transform&lt;\/span&gt;&lt;span style=&quot;color: #E7EE98&quot;&gt;.&lt;\/span&gt;&lt;span style=&quot;color: #F6F6F4&quot;&gt;position&lt;\/span&gt;&lt;span style=&quot;color: #E7EE98&quot;&gt;.&lt;\/span&gt;&lt;span style=&quot;color: #F6F6F4&quot;&gt;y&lt;\/span&gt;&lt;span style=&quot;color: #F286C4&quot;&gt;}&lt;\/span&gt;&lt;span style=&quot;color: #DEE492&quot;&gt;&quot;&lt;\/span&gt;&lt;span style=&quot;color: #F6F6F4&quot;&gt;);&lt;\/span&gt;&lt;\/span&gt;\n&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #F6F6F4&quot;&gt;}&lt;\/span&gt;&lt;\/span&gt;<\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">output:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.75rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#f6f6f4;--cbp-line-number-width:calc(2 * 0.6 * .75rem);line-height:1rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#282A36\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"9.996076\n9.988228\n9.976456\n9.96076\n9.94114\n9.917596\n9.890128\n9.858736\n9.82342\n9.78418\n9.741015\n9.693928\n9.642916\n9.587979\n9.529119\n9.466335\n9.399628\n9.328996\n9.254439\n9.17596\" style=\"color:#f6f6f4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dracula-soft\" style=\"background-color: #282A36\" tabindex=\"0\"><code class=\"\" data-line=\"\">&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #BF9EEE&quot;&gt;9.996076&lt;\/span&gt;&lt;\/span&gt;\n&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #BF9EEE&quot;&gt;9.988228&lt;\/span&gt;&lt;\/span&gt;\n&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #BF9EEE&quot;&gt;9.976456&lt;\/span&gt;&lt;\/span&gt;\n&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #BF9EEE&quot;&gt;9.96076&lt;\/span&gt;&lt;\/span&gt;\n&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #BF9EEE&quot;&gt;9.94114&lt;\/span&gt;&lt;\/span&gt;\n&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #BF9EEE&quot;&gt;9.917596&lt;\/span&gt;&lt;\/span&gt;\n&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #BF9EEE&quot;&gt;9.890128&lt;\/span&gt;&lt;\/span&gt;\n&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #BF9EEE&quot;&gt;9.858736&lt;\/span&gt;&lt;\/span&gt;\n&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #BF9EEE&quot;&gt;9.82342&lt;\/span&gt;&lt;\/span&gt;\n&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #BF9EEE&quot;&gt;9.78418&lt;\/span&gt;&lt;\/span&gt;\n&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #BF9EEE&quot;&gt;9.741015&lt;\/span&gt;&lt;\/span&gt;\n&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #BF9EEE&quot;&gt;9.693928&lt;\/span&gt;&lt;\/span&gt;\n&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #BF9EEE&quot;&gt;9.642916&lt;\/span&gt;&lt;\/span&gt;\n&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #BF9EEE&quot;&gt;9.587979&lt;\/span&gt;&lt;\/span&gt;\n&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #BF9EEE&quot;&gt;9.529119&lt;\/span&gt;&lt;\/span&gt;\n&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #BF9EEE&quot;&gt;9.466335&lt;\/span&gt;&lt;\/span&gt;\n&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #BF9EEE&quot;&gt;9.399628&lt;\/span&gt;&lt;\/span&gt;\n&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #BF9EEE&quot;&gt;9.328996&lt;\/span&gt;&lt;\/span&gt;\n&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #BF9EEE&quot;&gt;9.254439&lt;\/span&gt;&lt;\/span&gt;\n&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #BF9EEE&quot;&gt;9.17596&lt;\/span&gt;&lt;\/span&gt;<\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">When &#8216;Physics.Simulate&#8217; is placed at the bottom, not logging the sphere&#8217;s initial altitude. &#8216;Physics.Simulate&#8217; is just a function, the remaining code will be executed after it is completed.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When we set &#8216;Physics.simulationMode&#8217; to &#8216;Script&#8217;, we can manually control the fixed update using &#8216;Physics.Simulate&#8217;. Here, we observe the differences when &#8216;Physics.simulationMode&#8217; is placed at the top or [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25,26],"tags":[],"class_list":["post-225","post","type-post","status-publish","format-standard","hentry","category-in-english","category-unity"],"_links":{"self":[{"href":"https:\/\/tensorzen.online\/index.php?rest_route=\/wp\/v2\/posts\/225","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tensorzen.online\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tensorzen.online\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tensorzen.online\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tensorzen.online\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=225"}],"version-history":[{"count":2,"href":"https:\/\/tensorzen.online\/index.php?rest_route=\/wp\/v2\/posts\/225\/revisions"}],"predecessor-version":[{"id":275,"href":"https:\/\/tensorzen.online\/index.php?rest_route=\/wp\/v2\/posts\/225\/revisions\/275"}],"wp:attachment":[{"href":"https:\/\/tensorzen.online\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=225"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tensorzen.online\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=225"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tensorzen.online\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=225"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}