_independent_axis_constraint_part_8h_source.html 54 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
  5. <meta http-equiv="X-UA-Compatible" content="IE=11"/>
  6. <meta name="generator" content="Doxygen 1.12.0"/>
  7. <meta name="viewport" content="width=device-width, initial-scale=1"/>
  8. <title>Jolt Physics: Jolt/Physics/Constraints/ConstraintPart/IndependentAxisConstraintPart.h Source File</title>
  9. <link href="tabs.css" rel="stylesheet" type="text/css"/>
  10. <script type="text/javascript" src="jquery.js"></script>
  11. <script type="text/javascript" src="dynsections.js"></script>
  12. <script type="text/javascript" src="clipboard.js"></script>
  13. <link href="navtree.css" rel="stylesheet" type="text/css"/>
  14. <script type="text/javascript" src="navtreedata.js"></script>
  15. <script type="text/javascript" src="navtree.js"></script>
  16. <script type="text/javascript" src="resize.js"></script>
  17. <script type="text/javascript" src="cookie.js"></script>
  18. <link href="search/search.css" rel="stylesheet" type="text/css"/>
  19. <script type="text/javascript" src="search/searchdata.js"></script>
  20. <script type="text/javascript" src="search/search.js"></script>
  21. <script type="text/x-mathjax-config">
  22. MathJax.Hub.Config({
  23. extensions: ["tex2jax.js"],
  24. jax: ["input/TeX","output/HTML-CSS"],
  25. });
  26. </script>
  27. <script type="text/javascript" async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js"></script>
  28. <link href="doxygen.css" rel="stylesheet" type="text/css" />
  29. </head>
  30. <body>
  31. <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
  32. <div id="titlearea">
  33. <table cellspacing="0" cellpadding="0">
  34. <tbody>
  35. <tr id="projectrow">
  36. <td id="projectlogo"><img alt="Logo" src="LogoSmall.png"/></td>
  37. <td id="projectalign">
  38. <div id="projectname">Jolt Physics
  39. </div>
  40. <div id="projectbrief">A multi core friendly Game Physics Engine</div>
  41. </td>
  42. </tr>
  43. </tbody>
  44. </table>
  45. </div>
  46. <!-- end header part -->
  47. <!-- Generated by Doxygen 1.12.0 -->
  48. <script type="text/javascript">
  49. /* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
  50. var searchBox = new SearchBox("searchBox", "search/",'.html');
  51. /* @license-end */
  52. </script>
  53. <script type="text/javascript">
  54. /* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
  55. $(function() { codefold.init(0); });
  56. /* @license-end */
  57. </script>
  58. <script type="text/javascript" src="menudata.js"></script>
  59. <script type="text/javascript" src="menu.js"></script>
  60. <script type="text/javascript">
  61. /* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
  62. $(function() {
  63. initMenu('',true,false,'search.php','Search',true);
  64. $(function() { init_search(); });
  65. });
  66. /* @license-end */
  67. </script>
  68. <div id="main-nav"></div>
  69. </div><!-- top -->
  70. <div id="side-nav" class="ui-resizable side-nav-resizable">
  71. <div id="nav-tree">
  72. <div id="nav-tree-contents">
  73. <div id="nav-sync" class="sync"></div>
  74. </div>
  75. </div>
  76. <div id="splitbar" style="-moz-user-select:none;"
  77. class="ui-resizable-handle">
  78. </div>
  79. </div>
  80. <script type="text/javascript">
  81. /* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
  82. $(function(){initNavTree('_independent_axis_constraint_part_8h_source.html',''); initResizable(true); });
  83. /* @license-end */
  84. </script>
  85. <div id="doc-content">
  86. <!-- window showing the filter options -->
  87. <div id="MSearchSelectWindow"
  88. onmouseover="return searchBox.OnSearchSelectShow()"
  89. onmouseout="return searchBox.OnSearchSelectHide()"
  90. onkeydown="return searchBox.OnSearchSelectKey(event)">
  91. </div>
  92. <!-- iframe showing the search results (closed by default) -->
  93. <div id="MSearchResultsWindow">
  94. <div id="MSearchResults">
  95. <div class="SRPage">
  96. <div id="SRIndex">
  97. <div id="SRResults"></div>
  98. <div class="SRStatus" id="Loading">Loading...</div>
  99. <div class="SRStatus" id="Searching">Searching...</div>
  100. <div class="SRStatus" id="NoMatches">No Matches</div>
  101. </div>
  102. </div>
  103. </div>
  104. </div>
  105. <div class="header">
  106. <div class="headertitle"><div class="title">IndependentAxisConstraintPart.h</div></div>
  107. </div><!--header-->
  108. <div class="contents">
  109. <a href="_independent_axis_constraint_part_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span><span class="comment">// Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)</span></div>
  110. <div class="line"><a id="l00002" name="l00002"></a><span class="lineno"> 2</span><span class="comment">// SPDX-FileCopyrightText: 2022 Jorrit Rouwe</span></div>
  111. <div class="line"><a id="l00003" name="l00003"></a><span class="lineno"> 3</span><span class="comment">// SPDX-License-Identifier: MIT</span></div>
  112. <div class="line"><a id="l00004" name="l00004"></a><span class="lineno"> 4</span> </div>
  113. <div class="line"><a id="l00005" name="l00005"></a><span class="lineno"> 5</span><span class="preprocessor">#pragma once</span></div>
  114. <div class="line"><a id="l00006" name="l00006"></a><span class="lineno"> 6</span> </div>
  115. <div class="line"><a id="l00007" name="l00007"></a><span class="lineno"> 7</span><span class="preprocessor">#include &lt;<a class="code" href="_body_8h.html">Jolt/Physics/Body/Body.h</a>&gt;</span></div>
  116. <div class="line"><a id="l00008" name="l00008"></a><span class="lineno"> 8</span><span class="preprocessor">#include &lt;<a class="code" href="_state_recorder_8h.html">Jolt/Physics/StateRecorder.h</a>&gt;</span></div>
  117. <div class="line"><a id="l00009" name="l00009"></a><span class="lineno"> 9</span> </div>
  118. <div class="line"><a id="l00010" name="l00010"></a><span class="lineno"> 10</span><a class="code hl_define" href="_core_8h.html#ad14098b68b8c44ea6112601031268405">JPH_NAMESPACE_BEGIN</a></div>
  119. <div class="line"><a id="l00011" name="l00011"></a><span class="lineno"> 11</span> </div>
  120. <div class="foldopen" id="foldopen00047" data-start="{" data-end="};">
  121. <div class="line"><a id="l00047" name="l00047"></a><span class="lineno"><a class="line" href="class_independent_axis_constraint_part.html"> 47</a></span><span class="keyword">class </span><a class="code hl_class" href="class_independent_axis_constraint_part.html">IndependentAxisConstraintPart</a></div>
  122. <div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span>{</div>
  123. <div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span> JPH_INLINE <span class="keywordtype">bool</span> ApplyVelocityStep(<a class="code hl_class" href="class_body.html">Body</a> &amp;ioBody1, <a class="code hl_class" href="class_body.html">Body</a> &amp;ioBody2, <a class="code hl_class" href="class_vec3.html">Vec3Arg</a> inN1, <a class="code hl_class" href="class_vec3.html">Vec3Arg</a> inN2, <span class="keywordtype">float</span> inRatio, <span class="keywordtype">float</span> inLambda)<span class="keyword"> const</span></div>
  124. <div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span><span class="keyword"> </span>{</div>
  125. <div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span> <span class="comment">// Apply impulse if delta is not zero</span></div>
  126. <div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span> <span class="keywordflow">if</span> (inLambda != 0.0f)</div>
  127. <div class="line"><a id="l00054" name="l00054"></a><span class="lineno"> 54</span> {</div>
  128. <div class="line"><a id="l00055" name="l00055"></a><span class="lineno"> 55</span> <span class="comment">// Calculate velocity change due to constraint</span></div>
  129. <div class="line"><a id="l00056" name="l00056"></a><span class="lineno"> 56</span> <span class="comment">//</span></div>
  130. <div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span> <span class="comment">// Impulse:</span></div>
  131. <div class="line"><a id="l00058" name="l00058"></a><span class="lineno"> 58</span> <span class="comment">// P = J^T lambda</span></div>
  132. <div class="line"><a id="l00059" name="l00059"></a><span class="lineno"> 59</span> <span class="comment">//</span></div>
  133. <div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span> <span class="comment">// Euler velocity integration:</span></div>
  134. <div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span> <span class="comment">// v&#39; = v + M^-1 P</span></div>
  135. <div class="line"><a id="l00062" name="l00062"></a><span class="lineno"> 62</span> <span class="keywordflow">if</span> (ioBody1.<a class="code hl_function" href="class_body.html#a1b21c30907c8c9ce30c176a054057bef">IsDynamic</a>())</div>
  136. <div class="line"><a id="l00063" name="l00063"></a><span class="lineno"> 63</span> {</div>
  137. <div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span> <a class="code hl_class" href="class_motion_properties.html">MotionProperties</a> *mp1 = ioBody1.<a class="code hl_function" href="class_body.html#a0d39987255227c4221fcea66cb1fc041">GetMotionProperties</a>();</div>
  138. <div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span> mp1-&gt;<a class="code hl_function" href="class_motion_properties.html#a5b570eb5488b3ca5f0c1b48ef0cf6dbe">AddLinearVelocityStep</a>((mp1-&gt;<a class="code hl_function" href="class_motion_properties.html#a8a959bd2f7d8eb581d999e3b01920aa8">GetInverseMass</a>() * inLambda) * inN1);</div>
  139. <div class="line"><a id="l00066" name="l00066"></a><span class="lineno"> 66</span> mp1-&gt;<a class="code hl_function" href="class_motion_properties.html#afb12aa823a651145b46b271570a7af59">AddAngularVelocityStep</a>(mInvI1_R1xN1 * inLambda);</div>
  140. <div class="line"><a id="l00067" name="l00067"></a><span class="lineno"> 67</span> }</div>
  141. <div class="line"><a id="l00068" name="l00068"></a><span class="lineno"> 68</span> <span class="keywordflow">if</span> (ioBody2.<a class="code hl_function" href="class_body.html#a1b21c30907c8c9ce30c176a054057bef">IsDynamic</a>())</div>
  142. <div class="line"><a id="l00069" name="l00069"></a><span class="lineno"> 69</span> {</div>
  143. <div class="line"><a id="l00070" name="l00070"></a><span class="lineno"> 70</span> <a class="code hl_class" href="class_motion_properties.html">MotionProperties</a> *mp2 = ioBody2.<a class="code hl_function" href="class_body.html#a0d39987255227c4221fcea66cb1fc041">GetMotionProperties</a>();</div>
  144. <div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span> mp2-&gt;<a class="code hl_function" href="class_motion_properties.html#a5b570eb5488b3ca5f0c1b48ef0cf6dbe">AddLinearVelocityStep</a>((inRatio * mp2-&gt;<a class="code hl_function" href="class_motion_properties.html#a8a959bd2f7d8eb581d999e3b01920aa8">GetInverseMass</a>() * inLambda) * inN2);</div>
  145. <div class="line"><a id="l00072" name="l00072"></a><span class="lineno"> 72</span> mp2-&gt;<a class="code hl_function" href="class_motion_properties.html#afb12aa823a651145b46b271570a7af59">AddAngularVelocityStep</a>(mInvI2_RatioR2xN2 * inLambda);</div>
  146. <div class="line"><a id="l00073" name="l00073"></a><span class="lineno"> 73</span> }</div>
  147. <div class="line"><a id="l00074" name="l00074"></a><span class="lineno"> 74</span> <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
  148. <div class="line"><a id="l00075" name="l00075"></a><span class="lineno"> 75</span> }</div>
  149. <div class="line"><a id="l00076" name="l00076"></a><span class="lineno"> 76</span> </div>
  150. <div class="line"><a id="l00077" name="l00077"></a><span class="lineno"> 77</span> <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
  151. <div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span> }</div>
  152. <div class="line"><a id="l00079" name="l00079"></a><span class="lineno"> 79</span> </div>
  153. <div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span><span class="keyword">public</span>:</div>
  154. <div class="foldopen" id="foldopen00089" data-start="{" data-end="}">
  155. <div class="line"><a id="l00089" name="l00089"></a><span class="lineno"><a class="line" href="class_independent_axis_constraint_part.html#a0b42c35e39bcfe122954e5a2052dfafd"> 89</a></span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code hl_function" href="class_independent_axis_constraint_part.html#a0b42c35e39bcfe122954e5a2052dfafd">CalculateConstraintProperties</a>(<span class="keyword">const</span> <a class="code hl_class" href="class_body.html">Body</a> &amp;inBody1, <span class="keyword">const</span> <a class="code hl_class" href="class_body.html">Body</a> &amp;inBody2, <a class="code hl_class" href="class_vec3.html">Vec3Arg</a> inR1, <a class="code hl_class" href="class_vec3.html">Vec3Arg</a> inN1, <a class="code hl_class" href="class_vec3.html">Vec3Arg</a> inR2, <a class="code hl_class" href="class_vec3.html">Vec3Arg</a> inN2, <span class="keywordtype">float</span> inRatio)</div>
  156. <div class="line"><a id="l00090" name="l00090"></a><span class="lineno"> 90</span> {</div>
  157. <div class="line"><a id="l00091" name="l00091"></a><span class="lineno"> 91</span> <a class="code hl_define" href="_issue_reporting_8h.html#aaf6b1df827e11b7ca5f6f8778bd8f8cd">JPH_ASSERT</a>(inN1.<a class="code hl_function" href="class_vec3.html#a2f10743d69960eaac721399e4ede190a">IsNormalized</a>(1.0e-4f) &amp;&amp; inN2.<a class="code hl_function" href="class_vec3.html#a2f10743d69960eaac721399e4ede190a">IsNormalized</a>(1.0e-4f));</div>
  158. <div class="line"><a id="l00092" name="l00092"></a><span class="lineno"> 92</span> </div>
  159. <div class="line"><a id="l00093" name="l00093"></a><span class="lineno"> 93</span> <span class="keywordtype">float</span> inv_effective_mass = 0.0f;</div>
  160. <div class="line"><a id="l00094" name="l00094"></a><span class="lineno"> 94</span> </div>
  161. <div class="line"><a id="l00095" name="l00095"></a><span class="lineno"> 95</span> <span class="keywordflow">if</span> (!inBody1.<a class="code hl_function" href="class_body.html#a83748a3d5a5b0a5b0242ba91875b8e13">IsStatic</a>())</div>
  162. <div class="line"><a id="l00096" name="l00096"></a><span class="lineno"> 96</span> {</div>
  163. <div class="line"><a id="l00097" name="l00097"></a><span class="lineno"> 97</span> <span class="keyword">const</span> <a class="code hl_class" href="class_motion_properties.html">MotionProperties</a> *mp1 = inBody1.<a class="code hl_function" href="class_body.html#a0d39987255227c4221fcea66cb1fc041">GetMotionProperties</a>();</div>
  164. <div class="line"><a id="l00098" name="l00098"></a><span class="lineno"> 98</span> </div>
  165. <div class="line"><a id="l00099" name="l00099"></a><span class="lineno"> 99</span> mR1xN1 = inR1.<a class="code hl_function" href="class_vec3.html#a224811af391ccfd1e05282eda22d1de8">Cross</a>(inN1);</div>
  166. <div class="line"><a id="l00100" name="l00100"></a><span class="lineno"> 100</span> mInvI1_R1xN1 = mp1-&gt;<a class="code hl_function" href="class_motion_properties.html#aa8a73ea7940a316151262ed9a28c4fbb">MultiplyWorldSpaceInverseInertiaByVector</a>(inBody1.<a class="code hl_function" href="class_body.html#aaee24bfb5e32e756f50113b9d1f45a2c">GetRotation</a>(), mR1xN1);</div>
  167. <div class="line"><a id="l00101" name="l00101"></a><span class="lineno"> 101</span> </div>
  168. <div class="line"><a id="l00102" name="l00102"></a><span class="lineno"> 102</span> inv_effective_mass += mp1-&gt;<a class="code hl_function" href="class_motion_properties.html#a8a959bd2f7d8eb581d999e3b01920aa8">GetInverseMass</a>() + mInvI1_R1xN1.<a class="code hl_function" href="class_vec3.html#a0e078ff09f69e669db71a2b0e37939ff">Dot</a>(mR1xN1);</div>
  169. <div class="line"><a id="l00103" name="l00103"></a><span class="lineno"> 103</span> }</div>
  170. <div class="line"><a id="l00104" name="l00104"></a><span class="lineno"> 104</span> </div>
  171. <div class="line"><a id="l00105" name="l00105"></a><span class="lineno"> 105</span> <span class="keywordflow">if</span> (!inBody2.<a class="code hl_function" href="class_body.html#a83748a3d5a5b0a5b0242ba91875b8e13">IsStatic</a>())</div>
  172. <div class="line"><a id="l00106" name="l00106"></a><span class="lineno"> 106</span> {</div>
  173. <div class="line"><a id="l00107" name="l00107"></a><span class="lineno"> 107</span> <span class="keyword">const</span> <a class="code hl_class" href="class_motion_properties.html">MotionProperties</a> *mp2 = inBody2.<a class="code hl_function" href="class_body.html#a0d39987255227c4221fcea66cb1fc041">GetMotionProperties</a>();</div>
  174. <div class="line"><a id="l00108" name="l00108"></a><span class="lineno"> 108</span> </div>
  175. <div class="line"><a id="l00109" name="l00109"></a><span class="lineno"> 109</span> mRatioR2xN2 = inRatio * inR2.<a class="code hl_function" href="class_vec3.html#a224811af391ccfd1e05282eda22d1de8">Cross</a>(inN2);</div>
  176. <div class="line"><a id="l00110" name="l00110"></a><span class="lineno"> 110</span> mInvI2_RatioR2xN2 = mp2-&gt;<a class="code hl_function" href="class_motion_properties.html#aa8a73ea7940a316151262ed9a28c4fbb">MultiplyWorldSpaceInverseInertiaByVector</a>(inBody2.<a class="code hl_function" href="class_body.html#aaee24bfb5e32e756f50113b9d1f45a2c">GetRotation</a>(), mRatioR2xN2);</div>
  177. <div class="line"><a id="l00111" name="l00111"></a><span class="lineno"> 111</span> </div>
  178. <div class="line"><a id="l00112" name="l00112"></a><span class="lineno"> 112</span> inv_effective_mass += <a class="code hl_function" href="_math_8h.html#a61379b8b743a16fe823daeebc1482570">Square</a>(inRatio) * mp2-&gt;<a class="code hl_function" href="class_motion_properties.html#a8a959bd2f7d8eb581d999e3b01920aa8">GetInverseMass</a>() + mInvI2_RatioR2xN2.<a class="code hl_function" href="class_vec3.html#a0e078ff09f69e669db71a2b0e37939ff">Dot</a>(mRatioR2xN2);</div>
  179. <div class="line"><a id="l00113" name="l00113"></a><span class="lineno"> 113</span> }</div>
  180. <div class="line"><a id="l00114" name="l00114"></a><span class="lineno"> 114</span> </div>
  181. <div class="line"><a id="l00115" name="l00115"></a><span class="lineno"> 115</span> <span class="comment">// Calculate inverse effective mass: K = J M^-1 J^T</span></div>
  182. <div class="line"><a id="l00116" name="l00116"></a><span class="lineno"> 116</span> <span class="keywordflow">if</span> (inv_effective_mass == 0.0f)</div>
  183. <div class="line"><a id="l00117" name="l00117"></a><span class="lineno"> 117</span> <a class="code hl_function" href="class_independent_axis_constraint_part.html#a75a0e94426831c24d9a05022788a33a0">Deactivate</a>();</div>
  184. <div class="line"><a id="l00118" name="l00118"></a><span class="lineno"> 118</span> <span class="keywordflow">else</span></div>
  185. <div class="line"><a id="l00119" name="l00119"></a><span class="lineno"> 119</span> mEffectiveMass = 1.0f / inv_effective_mass;</div>
  186. <div class="line"><a id="l00120" name="l00120"></a><span class="lineno"> 120</span> }</div>
  187. </div>
  188. <div class="line"><a id="l00121" name="l00121"></a><span class="lineno"> 121</span> </div>
  189. <div class="foldopen" id="foldopen00123" data-start="{" data-end="}">
  190. <div class="line"><a id="l00123" name="l00123"></a><span class="lineno"><a class="line" href="class_independent_axis_constraint_part.html#a75a0e94426831c24d9a05022788a33a0"> 123</a></span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code hl_function" href="class_independent_axis_constraint_part.html#a75a0e94426831c24d9a05022788a33a0">Deactivate</a>()</div>
  191. <div class="line"><a id="l00124" name="l00124"></a><span class="lineno"> 124</span> {</div>
  192. <div class="line"><a id="l00125" name="l00125"></a><span class="lineno"> 125</span> mEffectiveMass = 0.0f;</div>
  193. <div class="line"><a id="l00126" name="l00126"></a><span class="lineno"> 126</span> mTotalLambda = 0.0f;</div>
  194. <div class="line"><a id="l00127" name="l00127"></a><span class="lineno"> 127</span> }</div>
  195. </div>
  196. <div class="line"><a id="l00128" name="l00128"></a><span class="lineno"> 128</span> </div>
  197. <div class="foldopen" id="foldopen00130" data-start="{" data-end="}">
  198. <div class="line"><a id="l00130" name="l00130"></a><span class="lineno"><a class="line" href="class_independent_axis_constraint_part.html#a564752c8c4a381de55000c66debc8b0f"> 130</a></span> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code hl_function" href="class_independent_axis_constraint_part.html#a564752c8c4a381de55000c66debc8b0f">IsActive</a>()<span class="keyword"> const</span></div>
  199. <div class="line"><a id="l00131" name="l00131"></a><span class="lineno"> 131</span><span class="keyword"> </span>{</div>
  200. <div class="line"><a id="l00132" name="l00132"></a><span class="lineno"> 132</span> <span class="keywordflow">return</span> mEffectiveMass != 0.0f;</div>
  201. <div class="line"><a id="l00133" name="l00133"></a><span class="lineno"> 133</span> }</div>
  202. </div>
  203. <div class="line"><a id="l00134" name="l00134"></a><span class="lineno"> 134</span> </div>
  204. <div class="foldopen" id="foldopen00142" data-start="{" data-end="}">
  205. <div class="line"><a id="l00142" name="l00142"></a><span class="lineno"><a class="line" href="class_independent_axis_constraint_part.html#a6ec13ff5361ad148d405ee79bbaedc6c"> 142</a></span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code hl_function" href="class_independent_axis_constraint_part.html#a6ec13ff5361ad148d405ee79bbaedc6c">WarmStart</a>(<a class="code hl_class" href="class_body.html">Body</a> &amp;ioBody1, <a class="code hl_class" href="class_body.html">Body</a> &amp;ioBody2, <a class="code hl_class" href="class_vec3.html">Vec3Arg</a> inN1, <a class="code hl_class" href="class_vec3.html">Vec3Arg</a> inN2, <span class="keywordtype">float</span> inRatio, <span class="keywordtype">float</span> inWarmStartImpulseRatio)</div>
  206. <div class="line"><a id="l00143" name="l00143"></a><span class="lineno"> 143</span> {</div>
  207. <div class="line"><a id="l00144" name="l00144"></a><span class="lineno"> 144</span> mTotalLambda *= inWarmStartImpulseRatio;</div>
  208. <div class="line"><a id="l00145" name="l00145"></a><span class="lineno"> 145</span> ApplyVelocityStep(ioBody1, ioBody2, inN1, inN2, inRatio, mTotalLambda);</div>
  209. <div class="line"><a id="l00146" name="l00146"></a><span class="lineno"> 146</span> }</div>
  210. </div>
  211. <div class="line"><a id="l00147" name="l00147"></a><span class="lineno"> 147</span> </div>
  212. <div class="foldopen" id="foldopen00156" data-start="{" data-end="}">
  213. <div class="line"><a id="l00156" name="l00156"></a><span class="lineno"><a class="line" href="class_independent_axis_constraint_part.html#a715a99f78d1e0f0cb03752d4279b4d05"> 156</a></span> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code hl_function" href="class_independent_axis_constraint_part.html#a715a99f78d1e0f0cb03752d4279b4d05">SolveVelocityConstraint</a>(<a class="code hl_class" href="class_body.html">Body</a> &amp;ioBody1, <a class="code hl_class" href="class_body.html">Body</a> &amp;ioBody2, <a class="code hl_class" href="class_vec3.html">Vec3Arg</a> inN1, <a class="code hl_class" href="class_vec3.html">Vec3Arg</a> inN2, <span class="keywordtype">float</span> inRatio, <span class="keywordtype">float</span> inMinLambda, <span class="keywordtype">float</span> inMaxLambda)</div>
  214. <div class="line"><a id="l00157" name="l00157"></a><span class="lineno"> 157</span> {</div>
  215. <div class="line"><a id="l00158" name="l00158"></a><span class="lineno"> 158</span> <span class="comment">// Lagrange multiplier is:</span></div>
  216. <div class="line"><a id="l00159" name="l00159"></a><span class="lineno"> 159</span> <span class="comment">//</span></div>
  217. <div class="line"><a id="l00160" name="l00160"></a><span class="lineno"> 160</span> <span class="comment">// lambda = -K^-1 (J v + b)</span></div>
  218. <div class="line"><a id="l00161" name="l00161"></a><span class="lineno"> 161</span> <span class="keywordtype">float</span> lambda = -mEffectiveMass * (inN1.<a class="code hl_function" href="class_vec3.html#a0e078ff09f69e669db71a2b0e37939ff">Dot</a>(ioBody1.<a class="code hl_function" href="class_body.html#a6451197a038f1d99b4b92beae4656842">GetLinearVelocity</a>()) + mR1xN1.<a class="code hl_function" href="class_vec3.html#a0e078ff09f69e669db71a2b0e37939ff">Dot</a>(ioBody1.<a class="code hl_function" href="class_body.html#adb1bb49db094ac2ef7c4951d07ba8417">GetAngularVelocity</a>()) + inRatio * inN2.<a class="code hl_function" href="class_vec3.html#a0e078ff09f69e669db71a2b0e37939ff">Dot</a>(ioBody2.<a class="code hl_function" href="class_body.html#a6451197a038f1d99b4b92beae4656842">GetLinearVelocity</a>()) + mRatioR2xN2.<a class="code hl_function" href="class_vec3.html#a0e078ff09f69e669db71a2b0e37939ff">Dot</a>(ioBody2.<a class="code hl_function" href="class_body.html#adb1bb49db094ac2ef7c4951d07ba8417">GetAngularVelocity</a>()));</div>
  219. <div class="line"><a id="l00162" name="l00162"></a><span class="lineno"> 162</span> <span class="keywordtype">float</span> new_lambda = <a class="code hl_function" href="_math_8h.html#a05be8f8200a1a67cbfacd3d16b17ac21">Clamp</a>(mTotalLambda + lambda, inMinLambda, inMaxLambda); <span class="comment">// Clamp impulse</span></div>
  220. <div class="line"><a id="l00163" name="l00163"></a><span class="lineno"> 163</span> lambda = new_lambda - mTotalLambda; <span class="comment">// Lambda potentially got clamped, calculate the new impulse to apply</span></div>
  221. <div class="line"><a id="l00164" name="l00164"></a><span class="lineno"> 164</span> mTotalLambda = new_lambda; <span class="comment">// Store accumulated impulse</span></div>
  222. <div class="line"><a id="l00165" name="l00165"></a><span class="lineno"> 165</span> </div>
  223. <div class="line"><a id="l00166" name="l00166"></a><span class="lineno"> 166</span> <span class="keywordflow">return</span> ApplyVelocityStep(ioBody1, ioBody2, inN1, inN2, inRatio, lambda);</div>
  224. <div class="line"><a id="l00167" name="l00167"></a><span class="lineno"> 167</span> }</div>
  225. </div>
  226. <div class="line"><a id="l00168" name="l00168"></a><span class="lineno"> 168</span> </div>
  227. <div class="foldopen" id="foldopen00170" data-start="{" data-end="}">
  228. <div class="line"><a id="l00170" name="l00170"></a><span class="lineno"><a class="line" href="class_independent_axis_constraint_part.html#a14a6dfff54b12cacff9f4794c5fa4fa8"> 170</a></span> <span class="keywordtype">float</span> <a class="code hl_function" href="class_independent_axis_constraint_part.html#a14a6dfff54b12cacff9f4794c5fa4fa8">GetTotalLambda</a>()<span class="keyword"> const</span></div>
  229. <div class="line"><a id="l00171" name="l00171"></a><span class="lineno"> 171</span><span class="keyword"> </span>{</div>
  230. <div class="line"><a id="l00172" name="l00172"></a><span class="lineno"> 172</span> <span class="keywordflow">return</span> mTotalLambda;</div>
  231. <div class="line"><a id="l00173" name="l00173"></a><span class="lineno"> 173</span> }</div>
  232. </div>
  233. <div class="line"><a id="l00174" name="l00174"></a><span class="lineno"> 174</span> </div>
  234. <div class="foldopen" id="foldopen00183" data-start="{" data-end="}">
  235. <div class="line"><a id="l00183" name="l00183"></a><span class="lineno"><a class="line" href="class_independent_axis_constraint_part.html#a75f7e8a6d760c806d8aadc911965ecce"> 183</a></span> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code hl_function" href="class_independent_axis_constraint_part.html#a75f7e8a6d760c806d8aadc911965ecce">SolvePositionConstraint</a>(<a class="code hl_class" href="class_body.html">Body</a> &amp;ioBody1, <a class="code hl_class" href="class_body.html">Body</a> &amp;ioBody2, <a class="code hl_class" href="class_vec3.html">Vec3Arg</a> inN1, <a class="code hl_class" href="class_vec3.html">Vec3Arg</a> inN2, <span class="keywordtype">float</span> inRatio, <span class="keywordtype">float</span> inC, <span class="keywordtype">float</span> inBaumgarte)<span class="keyword"> const</span></div>
  236. <div class="line"><a id="l00184" name="l00184"></a><span class="lineno"> 184</span><span class="keyword"> </span>{</div>
  237. <div class="line"><a id="l00185" name="l00185"></a><span class="lineno"> 185</span> <span class="keywordflow">if</span> (inC != 0.0f)</div>
  238. <div class="line"><a id="l00186" name="l00186"></a><span class="lineno"> 186</span> {</div>
  239. <div class="line"><a id="l00187" name="l00187"></a><span class="lineno"> 187</span> <span class="comment">// Calculate lagrange multiplier (lambda) for Baumgarte stabilization:</span></div>
  240. <div class="line"><a id="l00188" name="l00188"></a><span class="lineno"> 188</span> <span class="comment">//</span></div>
  241. <div class="line"><a id="l00189" name="l00189"></a><span class="lineno"> 189</span> <span class="comment">// lambda = -K^-1 * beta / dt * C</span></div>
  242. <div class="line"><a id="l00190" name="l00190"></a><span class="lineno"> 190</span> <span class="comment">//</span></div>
  243. <div class="line"><a id="l00191" name="l00191"></a><span class="lineno"> 191</span> <span class="comment">// We should divide by inDeltaTime, but we should multiply by inDeltaTime in the Euler step below so they&#39;re cancelled out</span></div>
  244. <div class="line"><a id="l00192" name="l00192"></a><span class="lineno"> 192</span> <span class="keywordtype">float</span> lambda = -mEffectiveMass * inBaumgarte * inC;</div>
  245. <div class="line"><a id="l00193" name="l00193"></a><span class="lineno"> 193</span> </div>
  246. <div class="line"><a id="l00194" name="l00194"></a><span class="lineno"> 194</span> <span class="comment">// Directly integrate velocity change for one time step</span></div>
  247. <div class="line"><a id="l00195" name="l00195"></a><span class="lineno"> 195</span> <span class="comment">//</span></div>
  248. <div class="line"><a id="l00196" name="l00196"></a><span class="lineno"> 196</span> <span class="comment">// Euler velocity integration:</span></div>
  249. <div class="line"><a id="l00197" name="l00197"></a><span class="lineno"> 197</span> <span class="comment">// dv = M^-1 P</span></div>
  250. <div class="line"><a id="l00198" name="l00198"></a><span class="lineno"> 198</span> <span class="comment">//</span></div>
  251. <div class="line"><a id="l00199" name="l00199"></a><span class="lineno"> 199</span> <span class="comment">// Impulse:</span></div>
  252. <div class="line"><a id="l00200" name="l00200"></a><span class="lineno"> 200</span> <span class="comment">// P = J^T lambda</span></div>
  253. <div class="line"><a id="l00201" name="l00201"></a><span class="lineno"> 201</span> <span class="comment">//</span></div>
  254. <div class="line"><a id="l00202" name="l00202"></a><span class="lineno"> 202</span> <span class="comment">// Euler position integration:</span></div>
  255. <div class="line"><a id="l00203" name="l00203"></a><span class="lineno"> 203</span> <span class="comment">// x&#39; = x + dv * dt</span></div>
  256. <div class="line"><a id="l00204" name="l00204"></a><span class="lineno"> 204</span> <span class="comment">//</span></div>
  257. <div class="line"><a id="l00205" name="l00205"></a><span class="lineno"> 205</span> <span class="comment">// Note we don&#39;t accumulate velocities for the stabilization. This is using the approach described in &#39;Modeling and</span></div>
  258. <div class="line"><a id="l00206" name="l00206"></a><span class="lineno"> 206</span> <span class="comment">// Solving Constraints&#39; by Erin Catto presented at GDC 2007. On slide 78 it is suggested to split up the Baumgarte</span></div>
  259. <div class="line"><a id="l00207" name="l00207"></a><span class="lineno"> 207</span> <span class="comment">// stabilization for positional drift so that it does not actually add to the momentum. We combine an Euler velocity</span></div>
  260. <div class="line"><a id="l00208" name="l00208"></a><span class="lineno"> 208</span> <span class="comment">// integrate + a position integrate and then discard the velocity change.</span></div>
  261. <div class="line"><a id="l00209" name="l00209"></a><span class="lineno"> 209</span> <span class="keywordflow">if</span> (ioBody1.<a class="code hl_function" href="class_body.html#a1b21c30907c8c9ce30c176a054057bef">IsDynamic</a>())</div>
  262. <div class="line"><a id="l00210" name="l00210"></a><span class="lineno"> 210</span> {</div>
  263. <div class="line"><a id="l00211" name="l00211"></a><span class="lineno"> 211</span> ioBody1.<a class="code hl_function" href="class_body.html#af98f831df76bd7e54eeb92d79fa3c8cd">AddPositionStep</a>((lambda * ioBody1.<a class="code hl_function" href="class_body.html#abe012219037c12313c7ef1116ee74865">GetMotionPropertiesUnchecked</a>()-&gt;<a class="code hl_function" href="class_motion_properties.html#a8a959bd2f7d8eb581d999e3b01920aa8">GetInverseMass</a>()) * inN1);</div>
  264. <div class="line"><a id="l00212" name="l00212"></a><span class="lineno"> 212</span> ioBody1.<a class="code hl_function" href="class_body.html#a3385650a73d75c7d9c16d13ea2d5519f">AddRotationStep</a>(lambda * mInvI1_R1xN1);</div>
  265. <div class="line"><a id="l00213" name="l00213"></a><span class="lineno"> 213</span> }</div>
  266. <div class="line"><a id="l00214" name="l00214"></a><span class="lineno"> 214</span> <span class="keywordflow">if</span> (ioBody2.<a class="code hl_function" href="class_body.html#a1b21c30907c8c9ce30c176a054057bef">IsDynamic</a>())</div>
  267. <div class="line"><a id="l00215" name="l00215"></a><span class="lineno"> 215</span> {</div>
  268. <div class="line"><a id="l00216" name="l00216"></a><span class="lineno"> 216</span> ioBody2.<a class="code hl_function" href="class_body.html#af98f831df76bd7e54eeb92d79fa3c8cd">AddPositionStep</a>((lambda * inRatio * ioBody2.<a class="code hl_function" href="class_body.html#abe012219037c12313c7ef1116ee74865">GetMotionPropertiesUnchecked</a>()-&gt;<a class="code hl_function" href="class_motion_properties.html#a8a959bd2f7d8eb581d999e3b01920aa8">GetInverseMass</a>()) * inN2);</div>
  269. <div class="line"><a id="l00217" name="l00217"></a><span class="lineno"> 217</span> ioBody2.<a class="code hl_function" href="class_body.html#a3385650a73d75c7d9c16d13ea2d5519f">AddRotationStep</a>(lambda * mInvI2_RatioR2xN2);</div>
  270. <div class="line"><a id="l00218" name="l00218"></a><span class="lineno"> 218</span> }</div>
  271. <div class="line"><a id="l00219" name="l00219"></a><span class="lineno"> 219</span> <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
  272. <div class="line"><a id="l00220" name="l00220"></a><span class="lineno"> 220</span> }</div>
  273. <div class="line"><a id="l00221" name="l00221"></a><span class="lineno"> 221</span> </div>
  274. <div class="line"><a id="l00222" name="l00222"></a><span class="lineno"> 222</span> <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
  275. <div class="line"><a id="l00223" name="l00223"></a><span class="lineno"> 223</span> }</div>
  276. </div>
  277. <div class="line"><a id="l00224" name="l00224"></a><span class="lineno"> 224</span> </div>
  278. <div class="foldopen" id="foldopen00226" data-start="{" data-end="}">
  279. <div class="line"><a id="l00226" name="l00226"></a><span class="lineno"><a class="line" href="class_independent_axis_constraint_part.html#a8982c9bb0de919245c5a463880877a32"> 226</a></span> <span class="keywordtype">void</span> <a class="code hl_function" href="class_independent_axis_constraint_part.html#a8982c9bb0de919245c5a463880877a32">SaveState</a>(<a class="code hl_class" href="class_state_recorder.html">StateRecorder</a> &amp;inStream)<span class="keyword"> const</span></div>
  280. <div class="line"><a id="l00227" name="l00227"></a><span class="lineno"> 227</span><span class="keyword"> </span>{</div>
  281. <div class="line"><a id="l00228" name="l00228"></a><span class="lineno"> 228</span> inStream.<a class="code hl_function" href="class_stream_out.html#a879dce6c6c6ca5e63835fe61cc745966">Write</a>(mTotalLambda);</div>
  282. <div class="line"><a id="l00229" name="l00229"></a><span class="lineno"> 229</span> }</div>
  283. </div>
  284. <div class="line"><a id="l00230" name="l00230"></a><span class="lineno"> 230</span> </div>
  285. <div class="foldopen" id="foldopen00232" data-start="{" data-end="}">
  286. <div class="line"><a id="l00232" name="l00232"></a><span class="lineno"><a class="line" href="class_independent_axis_constraint_part.html#a1b5d7adfe5abea0da836a725b91d4f85"> 232</a></span> <span class="keywordtype">void</span> <a class="code hl_function" href="class_independent_axis_constraint_part.html#a1b5d7adfe5abea0da836a725b91d4f85">RestoreState</a>(<a class="code hl_class" href="class_state_recorder.html">StateRecorder</a> &amp;inStream)</div>
  287. <div class="line"><a id="l00233" name="l00233"></a><span class="lineno"> 233</span> {</div>
  288. <div class="line"><a id="l00234" name="l00234"></a><span class="lineno"> 234</span> inStream.<a class="code hl_function" href="class_stream_in.html#a5ae9304c310edfc5ef1c67a95e36b1f3">Read</a>(mTotalLambda);</div>
  289. <div class="line"><a id="l00235" name="l00235"></a><span class="lineno"> 235</span> }</div>
  290. </div>
  291. <div class="line"><a id="l00236" name="l00236"></a><span class="lineno"> 236</span> </div>
  292. <div class="line"><a id="l00237" name="l00237"></a><span class="lineno"> 237</span><span class="keyword">private</span>:</div>
  293. <div class="line"><a id="l00238" name="l00238"></a><span class="lineno"> 238</span> <a class="code hl_class" href="class_vec3.html">Vec3</a> mR1xN1;</div>
  294. <div class="line"><a id="l00239" name="l00239"></a><span class="lineno"> 239</span> <a class="code hl_class" href="class_vec3.html">Vec3</a> mInvI1_R1xN1;</div>
  295. <div class="line"><a id="l00240" name="l00240"></a><span class="lineno"> 240</span> <a class="code hl_class" href="class_vec3.html">Vec3</a> mRatioR2xN2;</div>
  296. <div class="line"><a id="l00241" name="l00241"></a><span class="lineno"> 241</span> <a class="code hl_class" href="class_vec3.html">Vec3</a> mInvI2_RatioR2xN2;</div>
  297. <div class="line"><a id="l00242" name="l00242"></a><span class="lineno"> 242</span> <span class="keywordtype">float</span> mEffectiveMass = 0.0f;</div>
  298. <div class="line"><a id="l00243" name="l00243"></a><span class="lineno"> 243</span> <span class="keywordtype">float</span> mTotalLambda = 0.0f;</div>
  299. <div class="line"><a id="l00244" name="l00244"></a><span class="lineno"> 244</span>};</div>
  300. </div>
  301. <div class="line"><a id="l00245" name="l00245"></a><span class="lineno"> 245</span> </div>
  302. <div class="line"><a id="l00246" name="l00246"></a><span class="lineno"> 246</span><a class="code hl_define" href="_core_8h.html#a73da8725998b00321a9db341202d650d">JPH_NAMESPACE_END</a></div>
  303. <div class="ttc" id="a_body_8h_html"><div class="ttname"><a href="_body_8h.html">Body.h</a></div></div>
  304. <div class="ttc" id="a_core_8h_html_a73da8725998b00321a9db341202d650d"><div class="ttname"><a href="_core_8h.html#a73da8725998b00321a9db341202d650d">JPH_NAMESPACE_END</a></div><div class="ttdeci">#define JPH_NAMESPACE_END</div><div class="ttdef"><b>Definition</b> Core.h:425</div></div>
  305. <div class="ttc" id="a_core_8h_html_ad14098b68b8c44ea6112601031268405"><div class="ttname"><a href="_core_8h.html#ad14098b68b8c44ea6112601031268405">JPH_NAMESPACE_BEGIN</a></div><div class="ttdeci">#define JPH_NAMESPACE_BEGIN</div><div class="ttdef"><b>Definition</b> Core.h:419</div></div>
  306. <div class="ttc" id="a_issue_reporting_8h_html_aaf6b1df827e11b7ca5f6f8778bd8f8cd"><div class="ttname"><a href="_issue_reporting_8h.html#aaf6b1df827e11b7ca5f6f8778bd8f8cd">JPH_ASSERT</a></div><div class="ttdeci">#define JPH_ASSERT(...)</div><div class="ttdef"><b>Definition</b> IssueReporting.h:33</div></div>
  307. <div class="ttc" id="a_math_8h_html_a05be8f8200a1a67cbfacd3d16b17ac21"><div class="ttname"><a href="_math_8h.html#a05be8f8200a1a67cbfacd3d16b17ac21">Clamp</a></div><div class="ttdeci">JPH_INLINE constexpr T Clamp(T inV, T inMin, T inMax)</div><div class="ttdoc">Clamp a value between two values.</div><div class="ttdef"><b>Definition</b> Math.h:48</div></div>
  308. <div class="ttc" id="a_math_8h_html_a61379b8b743a16fe823daeebc1482570"><div class="ttname"><a href="_math_8h.html#a61379b8b743a16fe823daeebc1482570">Square</a></div><div class="ttdeci">JPH_INLINE constexpr T Square(T inV)</div><div class="ttdoc">Square a value.</div><div class="ttdef"><b>Definition</b> Math.h:55</div></div>
  309. <div class="ttc" id="a_state_recorder_8h_html"><div class="ttname"><a href="_state_recorder_8h.html">StateRecorder.h</a></div></div>
  310. <div class="ttc" id="aclass_body_html"><div class="ttname"><a href="class_body.html">Body</a></div><div class="ttdef"><b>Definition</b> Body.h:39</div></div>
  311. <div class="ttc" id="aclass_body_html_a0d39987255227c4221fcea66cb1fc041"><div class="ttname"><a href="class_body.html#a0d39987255227c4221fcea66cb1fc041">Body::GetMotionProperties</a></div><div class="ttdeci">const MotionProperties * GetMotionProperties() const</div><div class="ttdoc">Access to the motion properties.</div><div class="ttdef"><b>Definition</b> Body.h:308</div></div>
  312. <div class="ttc" id="aclass_body_html_a1b21c30907c8c9ce30c176a054057bef"><div class="ttname"><a href="class_body.html#a1b21c30907c8c9ce30c176a054057bef">Body::IsDynamic</a></div><div class="ttdeci">bool IsDynamic() const</div><div class="ttdoc">Check if this body is dynamic, which means that it moves and forces can act on it.</div><div class="ttdef"><b>Definition</b> Body.h:67</div></div>
  313. <div class="ttc" id="aclass_body_html_a3385650a73d75c7d9c16d13ea2d5519f"><div class="ttname"><a href="class_body.html#a3385650a73d75c7d9c16d13ea2d5519f">Body::AddRotationStep</a></div><div class="ttdeci">void AddRotationStep(Vec3Arg inAngularVelocityTimesDeltaTime)</div><div class="ttdoc">Update rotation using an Euler step (used during position integrate &amp; constraint solving)</div><div class="ttdef"><b>Definition</b> Body.inl:81</div></div>
  314. <div class="ttc" id="aclass_body_html_a6451197a038f1d99b4b92beae4656842"><div class="ttname"><a href="class_body.html#a6451197a038f1d99b4b92beae4656842">Body::GetLinearVelocity</a></div><div class="ttdeci">Vec3 GetLinearVelocity() const</div><div class="ttdoc">Get world space linear velocity of the center of mass (unit: m/s)</div><div class="ttdef"><b>Definition</b> Body.h:150</div></div>
  315. <div class="ttc" id="aclass_body_html_a83748a3d5a5b0a5b0242ba91875b8e13"><div class="ttname"><a href="class_body.html#a83748a3d5a5b0a5b0242ba91875b8e13">Body::IsStatic</a></div><div class="ttdeci">bool IsStatic() const</div><div class="ttdoc">Check if this body is static (not movable)</div><div class="ttdef"><b>Definition</b> Body.h:61</div></div>
  316. <div class="ttc" id="aclass_body_html_aaee24bfb5e32e756f50113b9d1f45a2c"><div class="ttname"><a href="class_body.html#aaee24bfb5e32e756f50113b9d1f45a2c">Body::GetRotation</a></div><div class="ttdeci">Quat GetRotation() const</div><div class="ttdoc">World space rotation of the body.</div><div class="ttdef"><b>Definition</b> Body.h:271</div></div>
  317. <div class="ttc" id="aclass_body_html_abe012219037c12313c7ef1116ee74865"><div class="ttname"><a href="class_body.html#abe012219037c12313c7ef1116ee74865">Body::GetMotionPropertiesUnchecked</a></div><div class="ttdeci">const MotionProperties * GetMotionPropertiesUnchecked() const</div><div class="ttdoc">Access to the motion properties (version that does not check if the object is kinematic or dynamic)</div><div class="ttdef"><b>Definition</b> Body.h:312</div></div>
  318. <div class="ttc" id="aclass_body_html_adb1bb49db094ac2ef7c4951d07ba8417"><div class="ttname"><a href="class_body.html#adb1bb49db094ac2ef7c4951d07ba8417">Body::GetAngularVelocity</a></div><div class="ttdeci">Vec3 GetAngularVelocity() const</div><div class="ttdoc">Get world space angular velocity of the center of mass (unit: rad/s)</div><div class="ttdef"><b>Definition</b> Body.h:161</div></div>
  319. <div class="ttc" id="aclass_body_html_af98f831df76bd7e54eeb92d79fa3c8cd"><div class="ttname"><a href="class_body.html#af98f831df76bd7e54eeb92d79fa3c8cd">Body::AddPositionStep</a></div><div class="ttdeci">void AddPositionStep(Vec3Arg inLinearVelocityTimesDeltaTime)</div><div class="ttdoc">Update position using an Euler step (used during position integrate &amp; constraint solving)</div><div class="ttdef"><b>Definition</b> Body.h:342</div></div>
  320. <div class="ttc" id="aclass_independent_axis_constraint_part_html"><div class="ttname"><a href="class_independent_axis_constraint_part.html">IndependentAxisConstraintPart</a></div><div class="ttdef"><b>Definition</b> IndependentAxisConstraintPart.h:48</div></div>
  321. <div class="ttc" id="aclass_independent_axis_constraint_part_html_a0b42c35e39bcfe122954e5a2052dfafd"><div class="ttname"><a href="class_independent_axis_constraint_part.html#a0b42c35e39bcfe122954e5a2052dfafd">IndependentAxisConstraintPart::CalculateConstraintProperties</a></div><div class="ttdeci">void CalculateConstraintProperties(const Body &amp;inBody1, const Body &amp;inBody2, Vec3Arg inR1, Vec3Arg inN1, Vec3Arg inR2, Vec3Arg inN2, float inRatio)</div><div class="ttdef"><b>Definition</b> IndependentAxisConstraintPart.h:89</div></div>
  322. <div class="ttc" id="aclass_independent_axis_constraint_part_html_a14a6dfff54b12cacff9f4794c5fa4fa8"><div class="ttname"><a href="class_independent_axis_constraint_part.html#a14a6dfff54b12cacff9f4794c5fa4fa8">IndependentAxisConstraintPart::GetTotalLambda</a></div><div class="ttdeci">float GetTotalLambda() const</div><div class="ttdoc">Return lagrange multiplier.</div><div class="ttdef"><b>Definition</b> IndependentAxisConstraintPart.h:170</div></div>
  323. <div class="ttc" id="aclass_independent_axis_constraint_part_html_a1b5d7adfe5abea0da836a725b91d4f85"><div class="ttname"><a href="class_independent_axis_constraint_part.html#a1b5d7adfe5abea0da836a725b91d4f85">IndependentAxisConstraintPart::RestoreState</a></div><div class="ttdeci">void RestoreState(StateRecorder &amp;inStream)</div><div class="ttdoc">Restore state of this constraint part.</div><div class="ttdef"><b>Definition</b> IndependentAxisConstraintPart.h:232</div></div>
  324. <div class="ttc" id="aclass_independent_axis_constraint_part_html_a564752c8c4a381de55000c66debc8b0f"><div class="ttname"><a href="class_independent_axis_constraint_part.html#a564752c8c4a381de55000c66debc8b0f">IndependentAxisConstraintPart::IsActive</a></div><div class="ttdeci">bool IsActive() const</div><div class="ttdoc">Check if constraint is active.</div><div class="ttdef"><b>Definition</b> IndependentAxisConstraintPart.h:130</div></div>
  325. <div class="ttc" id="aclass_independent_axis_constraint_part_html_a6ec13ff5361ad148d405ee79bbaedc6c"><div class="ttname"><a href="class_independent_axis_constraint_part.html#a6ec13ff5361ad148d405ee79bbaedc6c">IndependentAxisConstraintPart::WarmStart</a></div><div class="ttdeci">void WarmStart(Body &amp;ioBody1, Body &amp;ioBody2, Vec3Arg inN1, Vec3Arg inN2, float inRatio, float inWarmStartImpulseRatio)</div><div class="ttdef"><b>Definition</b> IndependentAxisConstraintPart.h:142</div></div>
  326. <div class="ttc" id="aclass_independent_axis_constraint_part_html_a715a99f78d1e0f0cb03752d4279b4d05"><div class="ttname"><a href="class_independent_axis_constraint_part.html#a715a99f78d1e0f0cb03752d4279b4d05">IndependentAxisConstraintPart::SolveVelocityConstraint</a></div><div class="ttdeci">bool SolveVelocityConstraint(Body &amp;ioBody1, Body &amp;ioBody2, Vec3Arg inN1, Vec3Arg inN2, float inRatio, float inMinLambda, float inMaxLambda)</div><div class="ttdef"><b>Definition</b> IndependentAxisConstraintPart.h:156</div></div>
  327. <div class="ttc" id="aclass_independent_axis_constraint_part_html_a75a0e94426831c24d9a05022788a33a0"><div class="ttname"><a href="class_independent_axis_constraint_part.html#a75a0e94426831c24d9a05022788a33a0">IndependentAxisConstraintPart::Deactivate</a></div><div class="ttdeci">void Deactivate()</div><div class="ttdoc">Deactivate this constraint.</div><div class="ttdef"><b>Definition</b> IndependentAxisConstraintPart.h:123</div></div>
  328. <div class="ttc" id="aclass_independent_axis_constraint_part_html_a75f7e8a6d760c806d8aadc911965ecce"><div class="ttname"><a href="class_independent_axis_constraint_part.html#a75f7e8a6d760c806d8aadc911965ecce">IndependentAxisConstraintPart::SolvePositionConstraint</a></div><div class="ttdeci">bool SolvePositionConstraint(Body &amp;ioBody1, Body &amp;ioBody2, Vec3Arg inN1, Vec3Arg inN2, float inRatio, float inC, float inBaumgarte) const</div><div class="ttdef"><b>Definition</b> IndependentAxisConstraintPart.h:183</div></div>
  329. <div class="ttc" id="aclass_independent_axis_constraint_part_html_a8982c9bb0de919245c5a463880877a32"><div class="ttname"><a href="class_independent_axis_constraint_part.html#a8982c9bb0de919245c5a463880877a32">IndependentAxisConstraintPart::SaveState</a></div><div class="ttdeci">void SaveState(StateRecorder &amp;inStream) const</div><div class="ttdoc">Save state of this constraint part.</div><div class="ttdef"><b>Definition</b> IndependentAxisConstraintPart.h:226</div></div>
  330. <div class="ttc" id="aclass_motion_properties_html"><div class="ttname"><a href="class_motion_properties.html">MotionProperties</a></div><div class="ttdoc">The Body class only keeps track of state for static bodies, the MotionProperties class keeps the addi...</div><div class="ttdef"><b>Definition</b> MotionProperties.h:29</div></div>
  331. <div class="ttc" id="aclass_motion_properties_html_a5b570eb5488b3ca5f0c1b48ef0cf6dbe"><div class="ttname"><a href="class_motion_properties.html#a5b570eb5488b3ca5f0c1b48ef0cf6dbe">MotionProperties::AddLinearVelocityStep</a></div><div class="ttdeci">void AddLinearVelocityStep(Vec3Arg inLinearVelocityChange)</div><div class="ttdef"><b>Definition</b> MotionProperties.h:217</div></div>
  332. <div class="ttc" id="aclass_motion_properties_html_a8a959bd2f7d8eb581d999e3b01920aa8"><div class="ttname"><a href="class_motion_properties.html#a8a959bd2f7d8eb581d999e3b01920aa8">MotionProperties::GetInverseMass</a></div><div class="ttdeci">float GetInverseMass() const</div><div class="ttdoc">Get inverse mass (1 / mass). Should only be called on a dynamic object (static or kinematic bodies ha...</div><div class="ttdef"><b>Definition</b> MotionProperties.h:95</div></div>
  333. <div class="ttc" id="aclass_motion_properties_html_aa8a73ea7940a316151262ed9a28c4fbb"><div class="ttname"><a href="class_motion_properties.html#aa8a73ea7940a316151262ed9a28c4fbb">MotionProperties::MultiplyWorldSpaceInverseInertiaByVector</a></div><div class="ttdeci">JPH_INLINE Vec3 MultiplyWorldSpaceInverseInertiaByVector(QuatArg inBodyRotation, Vec3Arg inV) const</div><div class="ttdoc">Multiply a vector with the inverse world space inertia tensor ( ). Zero if object is static or kinema...</div><div class="ttdef"><b>Definition</b> MotionProperties.inl:86</div></div>
  334. <div class="ttc" id="aclass_motion_properties_html_afb12aa823a651145b46b271570a7af59"><div class="ttname"><a href="class_motion_properties.html#afb12aa823a651145b46b271570a7af59">MotionProperties::AddAngularVelocityStep</a></div><div class="ttdeci">void AddAngularVelocityStep(Vec3Arg inAngularVelocityChange)</div><div class="ttdef"><b>Definition</b> MotionProperties.h:219</div></div>
  335. <div class="ttc" id="aclass_state_recorder_html"><div class="ttname"><a href="class_state_recorder.html">StateRecorder</a></div><div class="ttdef"><b>Definition</b> StateRecorder.h:110</div></div>
  336. <div class="ttc" id="aclass_stream_in_html_a5ae9304c310edfc5ef1c67a95e36b1f3"><div class="ttname"><a href="class_stream_in.html#a5ae9304c310edfc5ef1c67a95e36b1f3">StreamIn::Read</a></div><div class="ttdeci">void Read(T &amp;outT)</div><div class="ttdoc">Read a primitive (e.g. float, int, etc.) from the binary stream.</div><div class="ttdef"><b>Definition</b> StreamIn.h:30</div></div>
  337. <div class="ttc" id="aclass_stream_out_html_a879dce6c6c6ca5e63835fe61cc745966"><div class="ttname"><a href="class_stream_out.html#a879dce6c6c6ca5e63835fe61cc745966">StreamOut::Write</a></div><div class="ttdeci">void Write(const T &amp;inT)</div><div class="ttdoc">Write a primitive (e.g. float, int, etc.) to the binary stream.</div><div class="ttdef"><b>Definition</b> StreamOut.h:26</div></div>
  338. <div class="ttc" id="aclass_vec3_html"><div class="ttname"><a href="class_vec3.html">Vec3</a></div><div class="ttdef"><b>Definition</b> Vec3.h:17</div></div>
  339. <div class="ttc" id="aclass_vec3_html_a0e078ff09f69e669db71a2b0e37939ff"><div class="ttname"><a href="class_vec3.html#a0e078ff09f69e669db71a2b0e37939ff">Vec3::Dot</a></div><div class="ttdeci">JPH_INLINE float Dot(Vec3Arg inV2) const</div><div class="ttdoc">Dot product.</div><div class="ttdef"><b>Definition</b> Vec3.inl:650</div></div>
  340. <div class="ttc" id="aclass_vec3_html_a224811af391ccfd1e05282eda22d1de8"><div class="ttname"><a href="class_vec3.html#a224811af391ccfd1e05282eda22d1de8">Vec3::Cross</a></div><div class="ttdeci">JPH_INLINE Vec3 Cross(Vec3Arg inV2) const</div><div class="ttdoc">Cross product.</div><div class="ttdef"><b>Definition</b> Vec3.inl:595</div></div>
  341. <div class="ttc" id="aclass_vec3_html_a2f10743d69960eaac721399e4ede190a"><div class="ttname"><a href="class_vec3.html#a2f10743d69960eaac721399e4ede190a">Vec3::IsNormalized</a></div><div class="ttdeci">JPH_INLINE bool IsNormalized(float inTolerance=1.0e-6f) const</div><div class="ttdoc">Test if vector is normalized.</div><div class="ttdef"><b>Definition</b> Vec3.inl:752</div></div>
  342. </div><!-- fragment --></div><!-- contents -->
  343. </div><!-- doc-content -->
  344. <!-- start footer part -->
  345. <div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  346. <ul>
  347. <li class="navelem"><a class="el" href="dir_d99289a5d3c46cf26f14ff6c90658d9f.html">Jolt</a></li><li class="navelem"><a class="el" href="dir_a0f33af92addde396fc27b064c5eb8a9.html">Physics</a></li><li class="navelem"><a class="el" href="dir_166975991df1b4ecc6dd5a6639d45e50.html">Constraints</a></li><li class="navelem"><a class="el" href="dir_e6c5fb27ccbee0305acd3bb7c27d0472.html">ConstraintPart</a></li><li class="navelem"><a class="el" href="_independent_axis_constraint_part_8h.html">IndependentAxisConstraintPart.h</a></li>
  348. <li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.12.0 </li>
  349. </ul>
  350. </div>
  351. </body>
  352. </html>