| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370 |
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
- <head>
- <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
- <meta http-equiv="X-UA-Compatible" content="IE=11"/>
- <meta name="generator" content="Doxygen 1.12.0"/>
- <meta name="viewport" content="width=device-width, initial-scale=1"/>
- <title>Jolt Physics: Jolt/Physics/Constraints/ConstraintPart/HingeRotationConstraintPart.h Source File</title>
- <link href="tabs.css" rel="stylesheet" type="text/css"/>
- <script type="text/javascript" src="jquery.js"></script>
- <script type="text/javascript" src="dynsections.js"></script>
- <script type="text/javascript" src="clipboard.js"></script>
- <link href="navtree.css" rel="stylesheet" type="text/css"/>
- <script type="text/javascript" src="navtreedata.js"></script>
- <script type="text/javascript" src="navtree.js"></script>
- <script type="text/javascript" src="resize.js"></script>
- <script type="text/javascript" src="cookie.js"></script>
- <link href="search/search.css" rel="stylesheet" type="text/css"/>
- <script type="text/javascript" src="search/searchdata.js"></script>
- <script type="text/javascript" src="search/search.js"></script>
- <script type="text/x-mathjax-config">
- MathJax.Hub.Config({
- extensions: ["tex2jax.js"],
- jax: ["input/TeX","output/HTML-CSS"],
- });
- </script>
- <script type="text/javascript" async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js"></script>
- <link href="doxygen.css" rel="stylesheet" type="text/css" />
- </head>
- <body>
- <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
- <div id="titlearea">
- <table cellspacing="0" cellpadding="0">
- <tbody>
- <tr id="projectrow">
- <td id="projectlogo"><img alt="Logo" src="LogoSmall.png"/></td>
- <td id="projectalign">
- <div id="projectname">Jolt Physics
- </div>
- <div id="projectbrief">A multi core friendly Game Physics Engine</div>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <!-- end header part -->
- <!-- Generated by Doxygen 1.12.0 -->
- <script type="text/javascript">
- /* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
- var searchBox = new SearchBox("searchBox", "search/",'.html');
- /* @license-end */
- </script>
- <script type="text/javascript">
- /* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
- $(function() { codefold.init(0); });
- /* @license-end */
- </script>
- <script type="text/javascript" src="menudata.js"></script>
- <script type="text/javascript" src="menu.js"></script>
- <script type="text/javascript">
- /* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
- $(function() {
- initMenu('',true,false,'search.php','Search',true);
- $(function() { init_search(); });
- });
- /* @license-end */
- </script>
- <div id="main-nav"></div>
- </div><!-- top -->
- <div id="side-nav" class="ui-resizable side-nav-resizable">
- <div id="nav-tree">
- <div id="nav-tree-contents">
- <div id="nav-sync" class="sync"></div>
- </div>
- </div>
- <div id="splitbar" style="-moz-user-select:none;"
- class="ui-resizable-handle">
- </div>
- </div>
- <script type="text/javascript">
- /* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
- $(function(){initNavTree('_hinge_rotation_constraint_part_8h_source.html',''); initResizable(true); });
- /* @license-end */
- </script>
- <div id="doc-content">
- <!-- window showing the filter options -->
- <div id="MSearchSelectWindow"
- onmouseover="return searchBox.OnSearchSelectShow()"
- onmouseout="return searchBox.OnSearchSelectHide()"
- onkeydown="return searchBox.OnSearchSelectKey(event)">
- </div>
- <!-- iframe showing the search results (closed by default) -->
- <div id="MSearchResultsWindow">
- <div id="MSearchResults">
- <div class="SRPage">
- <div id="SRIndex">
- <div id="SRResults"></div>
- <div class="SRStatus" id="Loading">Loading...</div>
- <div class="SRStatus" id="Searching">Searching...</div>
- <div class="SRStatus" id="NoMatches">No Matches</div>
- </div>
- </div>
- </div>
- </div>
- <div class="header">
- <div class="headertitle"><div class="title">HingeRotationConstraintPart.h</div></div>
- </div><!--header-->
- <div class="contents">
- <a href="_hinge_rotation_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>
- <div class="line"><a id="l00002" name="l00002"></a><span class="lineno"> 2</span><span class="comment">// SPDX-FileCopyrightText: 2021 Jorrit Rouwe</span></div>
- <div class="line"><a id="l00003" name="l00003"></a><span class="lineno"> 3</span><span class="comment">// SPDX-License-Identifier: MIT</span></div>
- <div class="line"><a id="l00004" name="l00004"></a><span class="lineno"> 4</span> </div>
- <div class="line"><a id="l00005" name="l00005"></a><span class="lineno"> 5</span><span class="preprocessor">#pragma once</span></div>
- <div class="line"><a id="l00006" name="l00006"></a><span class="lineno"> 6</span> </div>
- <div class="line"><a id="l00007" name="l00007"></a><span class="lineno"> 7</span><span class="preprocessor">#include <<a class="code" href="_body_8h.html">Jolt/Physics/Body/Body.h</a>></span></div>
- <div class="line"><a id="l00008" name="l00008"></a><span class="lineno"> 8</span><span class="preprocessor">#include <<a class="code" href="_state_recorder_8h.html">Jolt/Physics/StateRecorder.h</a>></span></div>
- <div class="line"><a id="l00009" name="l00009"></a><span class="lineno"> 9</span><span class="preprocessor">#include <<a class="code" href="_vector_8h.html">Jolt/Math/Vector.h</a>></span></div>
- <div class="line"><a id="l00010" name="l00010"></a><span class="lineno"> 10</span><span class="preprocessor">#include <<a class="code" href="_matrix_8h.html">Jolt/Math/Matrix.h</a>></span></div>
- <div class="line"><a id="l00011" name="l00011"></a><span class="lineno"> 11</span> </div>
- <div class="line"><a id="l00012" name="l00012"></a><span class="lineno"> 12</span><a class="code hl_define" href="_core_8h.html#ad14098b68b8c44ea6112601031268405">JPH_NAMESPACE_BEGIN</a></div>
- <div class="line"><a id="l00013" name="l00013"></a><span class="lineno"> 13</span> </div>
- <div class="foldopen" id="foldopen00043" data-start="{" data-end="};">
- <div class="line"><a id="l00043" name="l00043"></a><span class="lineno"><a class="line" href="class_hinge_rotation_constraint_part.html"> 43</a></span><span class="keyword">class </span><a class="code hl_class" href="class_hinge_rotation_constraint_part.html">HingeRotationConstraintPart</a></div>
- <div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span>{</div>
- <div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</span><span class="keyword">public</span>:</div>
- <div class="line"><a id="l00046" name="l00046"></a><span class="lineno"><a class="line" href="class_hinge_rotation_constraint_part.html#ac0464fe586004502d840466631aaa7b0"> 46</a></span> <span class="keyword">using </span><a class="code hl_class" href="class_vector.html">Vec2</a> = <a class="code hl_class" href="class_vector.html">Vector<2></a>;</div>
- <div class="line"><a id="l00047" name="l00047"></a><span class="lineno"><a class="line" href="class_hinge_rotation_constraint_part.html#ab1f18a0c76566111d337d6d175b8bbc6"> 47</a></span> <span class="keyword">using </span><a class="code hl_class" href="class_matrix.html">Mat22</a> = <a class="code hl_class" href="class_matrix.html">Matrix<2, 2></a>;</div>
- <div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span> </div>
- <div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span><span class="keyword">private</span>:</div>
- <div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span> JPH_INLINE <span class="keywordtype">bool</span> ApplyVelocityStep(<a class="code hl_class" href="class_body.html">Body</a> &ioBody1, <a class="code hl_class" href="class_body.html">Body</a> &ioBody2, <span class="keyword">const</span> <a class="code hl_class" href="class_vector.html">Vec2</a> &inLambda)<span class="keyword"> const</span></div>
- <div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span><span class="keyword"> </span>{</div>
- <div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span> <span class="comment">// Apply impulse if delta is not zero</span></div>
- <div class="line"><a id="l00054" name="l00054"></a><span class="lineno"> 54</span> <span class="keywordflow">if</span> (!inLambda.<a class="code hl_function" href="class_vector.html#ab1368364228755bfe9e64af3654ea995">IsZero</a>())</div>
- <div class="line"><a id="l00055" name="l00055"></a><span class="lineno"> 55</span> {</div>
- <div class="line"><a id="l00056" name="l00056"></a><span class="lineno"> 56</span> <span class="comment">// Calculate velocity change due to constraint</span></div>
- <div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span> <span class="comment">//</span></div>
- <div class="line"><a id="l00058" name="l00058"></a><span class="lineno"> 58</span> <span class="comment">// Impulse:</span></div>
- <div class="line"><a id="l00059" name="l00059"></a><span class="lineno"> 59</span> <span class="comment">// P = J^T lambda</span></div>
- <div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span> <span class="comment">//</span></div>
- <div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span> <span class="comment">// Euler velocity integration:</span></div>
- <div class="line"><a id="l00062" name="l00062"></a><span class="lineno"> 62</span> <span class="comment">// v' = v + M^-1 P</span></div>
- <div class="line"><a id="l00063" name="l00063"></a><span class="lineno"> 63</span> <a class="code hl_class" href="class_vec3.html">Vec3</a> impulse = mB2xA1 * inLambda[0] + mC2xA1 * inLambda[1];</div>
- <div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span> <span class="keywordflow">if</span> (ioBody1.<a class="code hl_function" href="class_body.html#a1b21c30907c8c9ce30c176a054057bef">IsDynamic</a>())</div>
- <div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span> ioBody1.<a class="code hl_function" href="class_body.html#a0d39987255227c4221fcea66cb1fc041">GetMotionProperties</a>()-><a class="code hl_function" href="class_motion_properties.html#a98672fc0c6884643944e570e1d78ac07">SubAngularVelocityStep</a>(mInvI1.<a class="code hl_function" href="class_mat44.html#ab599aaeab3e4b832f7f4097816650b14">Multiply3x3</a>(impulse));</div>
- <div class="line"><a id="l00066" name="l00066"></a><span class="lineno"> 66</span> <span class="keywordflow">if</span> (ioBody2.<a class="code hl_function" href="class_body.html#a1b21c30907c8c9ce30c176a054057bef">IsDynamic</a>())</div>
- <div class="line"><a id="l00067" name="l00067"></a><span class="lineno"> 67</span> ioBody2.<a class="code hl_function" href="class_body.html#a0d39987255227c4221fcea66cb1fc041">GetMotionProperties</a>()-><a class="code hl_function" href="class_motion_properties.html#afb12aa823a651145b46b271570a7af59">AddAngularVelocityStep</a>(mInvI2.<a class="code hl_function" href="class_mat44.html#ab599aaeab3e4b832f7f4097816650b14">Multiply3x3</a>(impulse));</div>
- <div class="line"><a id="l00068" name="l00068"></a><span class="lineno"> 68</span> <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
- <div class="line"><a id="l00069" name="l00069"></a><span class="lineno"> 69</span> }</div>
- <div class="line"><a id="l00070" name="l00070"></a><span class="lineno"> 70</span> </div>
- <div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span> <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
- <div class="line"><a id="l00072" name="l00072"></a><span class="lineno"> 72</span> }</div>
- <div class="line"><a id="l00073" name="l00073"></a><span class="lineno"> 73</span> </div>
- <div class="line"><a id="l00074" name="l00074"></a><span class="lineno"> 74</span><span class="keyword">public</span>:</div>
- <div class="foldopen" id="foldopen00076" data-start="{" data-end="}">
- <div class="line"><a id="l00076" name="l00076"></a><span class="lineno"><a class="line" href="class_hinge_rotation_constraint_part.html#a41471ce4cbe4f3b915ba40f883a3f924"> 76</a></span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code hl_function" href="class_hinge_rotation_constraint_part.html#a41471ce4cbe4f3b915ba40f883a3f924">CalculateConstraintProperties</a>(<span class="keyword">const</span> <a class="code hl_class" href="class_body.html">Body</a> &inBody1, <a class="code hl_class" href="class_mat44.html">Mat44Arg</a> inRotation1, <a class="code hl_class" href="class_vec3.html">Vec3Arg</a> inWorldSpaceHingeAxis1, <span class="keyword">const</span> <a class="code hl_class" href="class_body.html">Body</a> &inBody2, <a class="code hl_class" href="class_mat44.html">Mat44Arg</a> inRotation2, <a class="code hl_class" href="class_vec3.html">Vec3Arg</a> inWorldSpaceHingeAxis2)</div>
- <div class="line"><a id="l00077" name="l00077"></a><span class="lineno"> 77</span> {</div>
- <div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span> <a class="code hl_define" href="_issue_reporting_8h.html#aaf6b1df827e11b7ca5f6f8778bd8f8cd">JPH_ASSERT</a>(inWorldSpaceHingeAxis1.<a class="code hl_function" href="class_vec3.html#a2f10743d69960eaac721399e4ede190a">IsNormalized</a>(1.0e-5f));</div>
- <div class="line"><a id="l00079" name="l00079"></a><span class="lineno"> 79</span> <a class="code hl_define" href="_issue_reporting_8h.html#aaf6b1df827e11b7ca5f6f8778bd8f8cd">JPH_ASSERT</a>(inWorldSpaceHingeAxis2.<a class="code hl_function" href="class_vec3.html#a2f10743d69960eaac721399e4ede190a">IsNormalized</a>(1.0e-5f));</div>
- <div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span> </div>
- <div class="line"><a id="l00081" name="l00081"></a><span class="lineno"> 81</span> <span class="comment">// Calculate hinge axis in world space</span></div>
- <div class="line"><a id="l00082" name="l00082"></a><span class="lineno"> 82</span> mA1 = inWorldSpaceHingeAxis1;</div>
- <div class="line"><a id="l00083" name="l00083"></a><span class="lineno"> 83</span> <a class="code hl_class" href="class_vec3.html">Vec3</a> a2 = inWorldSpaceHingeAxis2;</div>
- <div class="line"><a id="l00084" name="l00084"></a><span class="lineno"> 84</span> <span class="keywordtype">float</span> dot = mA1.<a class="code hl_function" href="class_vec3.html#a0e078ff09f69e669db71a2b0e37939ff">Dot</a>(a2);</div>
- <div class="line"><a id="l00085" name="l00085"></a><span class="lineno"> 85</span> <span class="keywordflow">if</span> (dot <= 1.0e-3f)</div>
- <div class="line"><a id="l00086" name="l00086"></a><span class="lineno"> 86</span> {</div>
- <div class="line"><a id="l00087" name="l00087"></a><span class="lineno"> 87</span> <span class="comment">// World space axes are more than 90 degrees apart, get a perpendicular vector in the plane formed by mA1 and a2 as hinge axis until the rotation is less than 90 degrees</span></div>
- <div class="line"><a id="l00088" name="l00088"></a><span class="lineno"> 88</span> <a class="code hl_class" href="class_vec3.html">Vec3</a> perp = a2 - dot * mA1;</div>
- <div class="line"><a id="l00089" name="l00089"></a><span class="lineno"> 89</span> <span class="keywordflow">if</span> (perp.<a class="code hl_function" href="class_vec3.html#aba501a6a474028084799f871c9083dc1">LengthSq</a>() < 1.0e-6f)</div>
- <div class="line"><a id="l00090" name="l00090"></a><span class="lineno"> 90</span> {</div>
- <div class="line"><a id="l00091" name="l00091"></a><span class="lineno"> 91</span> <span class="comment">// mA1 ~ -a2, take random perpendicular</span></div>
- <div class="line"><a id="l00092" name="l00092"></a><span class="lineno"> 92</span> perp = mA1.<a class="code hl_function" href="class_vec3.html#a24a96972fdbe04ae9a3e340fd4c39b81">GetNormalizedPerpendicular</a>();</div>
- <div class="line"><a id="l00093" name="l00093"></a><span class="lineno"> 93</span> }</div>
- <div class="line"><a id="l00094" name="l00094"></a><span class="lineno"> 94</span> </div>
- <div class="line"><a id="l00095" name="l00095"></a><span class="lineno"> 95</span> <span class="comment">// Blend in a little bit from mA1 so we're less than 90 degrees apart</span></div>
- <div class="line"><a id="l00096" name="l00096"></a><span class="lineno"> 96</span> a2 = (0.99f * perp.<a class="code hl_function" href="class_vec3.html#a0f7559f2691ad67826f42ca19916b7a9">Normalized</a>() + 0.01f * mA1).<a class="code hl_function" href="class_vec3.html#a0f7559f2691ad67826f42ca19916b7a9">Normalized</a>();</div>
- <div class="line"><a id="l00097" name="l00097"></a><span class="lineno"> 97</span> }</div>
- <div class="line"><a id="l00098" name="l00098"></a><span class="lineno"> 98</span> mB2 = a2.<a class="code hl_function" href="class_vec3.html#a24a96972fdbe04ae9a3e340fd4c39b81">GetNormalizedPerpendicular</a>();</div>
- <div class="line"><a id="l00099" name="l00099"></a><span class="lineno"> 99</span> mC2 = a2.<a class="code hl_function" href="class_vec3.html#a224811af391ccfd1e05282eda22d1de8">Cross</a>(mB2);</div>
- <div class="line"><a id="l00100" name="l00100"></a><span class="lineno"> 100</span> </div>
- <div class="line"><a id="l00101" name="l00101"></a><span class="lineno"> 101</span> <span class="comment">// Calculate properties used during constraint solving</span></div>
- <div class="line"><a id="l00102" name="l00102"></a><span class="lineno"> 102</span> mInvI1 = inBody1.<a class="code hl_function" href="class_body.html#a1b21c30907c8c9ce30c176a054057bef">IsDynamic</a>()? inBody1.<a class="code hl_function" href="class_body.html#a0d39987255227c4221fcea66cb1fc041">GetMotionProperties</a>()-><a class="code hl_function" href="class_motion_properties.html#ab95f2b1c9b6bd9b6082f8cee8a7e1858">GetInverseInertiaForRotation</a>(inRotation1) : <a class="code hl_function" href="class_mat44.html#a1e3a8da1cf3a631ffaf478ca3f6bb1ed">Mat44::sZero</a>();</div>
- <div class="line"><a id="l00103" name="l00103"></a><span class="lineno"> 103</span> mInvI2 = inBody2.<a class="code hl_function" href="class_body.html#a1b21c30907c8c9ce30c176a054057bef">IsDynamic</a>()? inBody2.<a class="code hl_function" href="class_body.html#a0d39987255227c4221fcea66cb1fc041">GetMotionProperties</a>()-><a class="code hl_function" href="class_motion_properties.html#ab95f2b1c9b6bd9b6082f8cee8a7e1858">GetInverseInertiaForRotation</a>(inRotation2) : <a class="code hl_function" href="class_mat44.html#a1e3a8da1cf3a631ffaf478ca3f6bb1ed">Mat44::sZero</a>();</div>
- <div class="line"><a id="l00104" name="l00104"></a><span class="lineno"> 104</span> mB2xA1 = mB2.<a class="code hl_function" href="class_vec3.html#a224811af391ccfd1e05282eda22d1de8">Cross</a>(mA1);</div>
- <div class="line"><a id="l00105" name="l00105"></a><span class="lineno"> 105</span> mC2xA1 = mC2.<a class="code hl_function" href="class_vec3.html#a224811af391ccfd1e05282eda22d1de8">Cross</a>(mA1);</div>
- <div class="line"><a id="l00106" name="l00106"></a><span class="lineno"> 106</span> </div>
- <div class="line"><a id="l00107" name="l00107"></a><span class="lineno"> 107</span> <span class="comment">// Calculate effective mass: K^-1 = (J M^-1 J^T)^-1</span></div>
- <div class="line"><a id="l00108" name="l00108"></a><span class="lineno"> 108</span> <a class="code hl_class" href="class_mat44.html">Mat44</a> summed_inv_inertia = mInvI1 + mInvI2;</div>
- <div class="line"><a id="l00109" name="l00109"></a><span class="lineno"> 109</span> <a class="code hl_class" href="class_matrix.html">Mat22</a> inv_effective_mass;</div>
- <div class="line"><a id="l00110" name="l00110"></a><span class="lineno"> 110</span> inv_effective_mass(0, 0) = mB2xA1.<a class="code hl_function" href="class_vec3.html#a0e078ff09f69e669db71a2b0e37939ff">Dot</a>(summed_inv_inertia.<a class="code hl_function" href="class_mat44.html#ab599aaeab3e4b832f7f4097816650b14">Multiply3x3</a>(mB2xA1));</div>
- <div class="line"><a id="l00111" name="l00111"></a><span class="lineno"> 111</span> inv_effective_mass(0, 1) = mB2xA1.<a class="code hl_function" href="class_vec3.html#a0e078ff09f69e669db71a2b0e37939ff">Dot</a>(summed_inv_inertia.<a class="code hl_function" href="class_mat44.html#ab599aaeab3e4b832f7f4097816650b14">Multiply3x3</a>(mC2xA1));</div>
- <div class="line"><a id="l00112" name="l00112"></a><span class="lineno"> 112</span> inv_effective_mass(1, 0) = mC2xA1.<a class="code hl_function" href="class_vec3.html#a0e078ff09f69e669db71a2b0e37939ff">Dot</a>(summed_inv_inertia.<a class="code hl_function" href="class_mat44.html#ab599aaeab3e4b832f7f4097816650b14">Multiply3x3</a>(mB2xA1));</div>
- <div class="line"><a id="l00113" name="l00113"></a><span class="lineno"> 113</span> inv_effective_mass(1, 1) = mC2xA1.<a class="code hl_function" href="class_vec3.html#a0e078ff09f69e669db71a2b0e37939ff">Dot</a>(summed_inv_inertia.<a class="code hl_function" href="class_mat44.html#ab599aaeab3e4b832f7f4097816650b14">Multiply3x3</a>(mC2xA1));</div>
- <div class="line"><a id="l00114" name="l00114"></a><span class="lineno"> 114</span> <span class="keywordflow">if</span> (!mEffectiveMass.<a class="code hl_function" href="class_matrix.html#a1e2531318f995ae102d4428c3bdba738">SetInversed</a>(inv_effective_mass))</div>
- <div class="line"><a id="l00115" name="l00115"></a><span class="lineno"> 115</span> <a class="code hl_function" href="class_hinge_rotation_constraint_part.html#a4ae072cae1beb84f1e87eafff60f0022">Deactivate</a>();</div>
- <div class="line"><a id="l00116" name="l00116"></a><span class="lineno"> 116</span> }</div>
- </div>
- <div class="line"><a id="l00117" name="l00117"></a><span class="lineno"> 117</span> </div>
- <div class="foldopen" id="foldopen00119" data-start="{" data-end="}">
- <div class="line"><a id="l00119" name="l00119"></a><span class="lineno"><a class="line" href="class_hinge_rotation_constraint_part.html#a4ae072cae1beb84f1e87eafff60f0022"> 119</a></span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code hl_function" href="class_hinge_rotation_constraint_part.html#a4ae072cae1beb84f1e87eafff60f0022">Deactivate</a>()</div>
- <div class="line"><a id="l00120" name="l00120"></a><span class="lineno"> 120</span> {</div>
- <div class="line"><a id="l00121" name="l00121"></a><span class="lineno"> 121</span> mEffectiveMass.<a class="code hl_function" href="class_matrix.html#a7b98e3c672cc83e50b0cb6cf33b1ec65">SetZero</a>();</div>
- <div class="line"><a id="l00122" name="l00122"></a><span class="lineno"> 122</span> mTotalLambda.<a class="code hl_function" href="class_vector.html#a06ffa8aa3d40e7c93dde19725e77ff3a">SetZero</a>();</div>
- <div class="line"><a id="l00123" name="l00123"></a><span class="lineno"> 123</span> }</div>
- </div>
- <div class="line"><a id="l00124" name="l00124"></a><span class="lineno"> 124</span> </div>
- <div class="foldopen" id="foldopen00126" data-start="{" data-end="}">
- <div class="line"><a id="l00126" name="l00126"></a><span class="lineno"><a class="line" href="class_hinge_rotation_constraint_part.html#aa71c15ea49da0d82a70d8edf787f612b"> 126</a></span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code hl_function" href="class_hinge_rotation_constraint_part.html#aa71c15ea49da0d82a70d8edf787f612b">WarmStart</a>(<a class="code hl_class" href="class_body.html">Body</a> &ioBody1, <a class="code hl_class" href="class_body.html">Body</a> &ioBody2, <span class="keywordtype">float</span> inWarmStartImpulseRatio)</div>
- <div class="line"><a id="l00127" name="l00127"></a><span class="lineno"> 127</span> {</div>
- <div class="line"><a id="l00128" name="l00128"></a><span class="lineno"> 128</span> mTotalLambda *= inWarmStartImpulseRatio;</div>
- <div class="line"><a id="l00129" name="l00129"></a><span class="lineno"> 129</span> ApplyVelocityStep(ioBody1, ioBody2, mTotalLambda);</div>
- <div class="line"><a id="l00130" name="l00130"></a><span class="lineno"> 130</span> }</div>
- </div>
- <div class="line"><a id="l00131" name="l00131"></a><span class="lineno"> 131</span> </div>
- <div class="foldopen" id="foldopen00133" data-start="{" data-end="}">
- <div class="line"><a id="l00133" name="l00133"></a><span class="lineno"><a class="line" href="class_hinge_rotation_constraint_part.html#aabd46260672295ed6df506bf81a2f326"> 133</a></span> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code hl_function" href="class_hinge_rotation_constraint_part.html#aabd46260672295ed6df506bf81a2f326">SolveVelocityConstraint</a>(<a class="code hl_class" href="class_body.html">Body</a> &ioBody1, <a class="code hl_class" href="class_body.html">Body</a> &ioBody2)</div>
- <div class="line"><a id="l00134" name="l00134"></a><span class="lineno"> 134</span> {</div>
- <div class="line"><a id="l00135" name="l00135"></a><span class="lineno"> 135</span> <span class="comment">// Calculate lagrange multiplier:</span></div>
- <div class="line"><a id="l00136" name="l00136"></a><span class="lineno"> 136</span> <span class="comment">//</span></div>
- <div class="line"><a id="l00137" name="l00137"></a><span class="lineno"> 137</span> <span class="comment">// lambda = -K^-1 (J v + b)</span></div>
- <div class="line"><a id="l00138" name="l00138"></a><span class="lineno"> 138</span> <a class="code hl_class" href="class_vec3.html">Vec3</a> delta_ang = ioBody1.<a class="code hl_function" href="class_body.html#adb1bb49db094ac2ef7c4951d07ba8417">GetAngularVelocity</a>() - ioBody2.<a class="code hl_function" href="class_body.html#adb1bb49db094ac2ef7c4951d07ba8417">GetAngularVelocity</a>();</div>
- <div class="line"><a id="l00139" name="l00139"></a><span class="lineno"> 139</span> <a class="code hl_class" href="class_vector.html">Vec2</a> jv;</div>
- <div class="line"><a id="l00140" name="l00140"></a><span class="lineno"> 140</span> jv[0] = mB2xA1.<a class="code hl_function" href="class_vec3.html#a0e078ff09f69e669db71a2b0e37939ff">Dot</a>(delta_ang);</div>
- <div class="line"><a id="l00141" name="l00141"></a><span class="lineno"> 141</span> jv[1] = mC2xA1.<a class="code hl_function" href="class_vec3.html#a0e078ff09f69e669db71a2b0e37939ff">Dot</a>(delta_ang);</div>
- <div class="line"><a id="l00142" name="l00142"></a><span class="lineno"> 142</span> <a class="code hl_class" href="class_vector.html">Vec2</a> lambda = mEffectiveMass * jv;</div>
- <div class="line"><a id="l00143" name="l00143"></a><span class="lineno"> 143</span> </div>
- <div class="line"><a id="l00144" name="l00144"></a><span class="lineno"> 144</span> <span class="comment">// Store accumulated lambda</span></div>
- <div class="line"><a id="l00145" name="l00145"></a><span class="lineno"> 145</span> mTotalLambda += lambda;</div>
- <div class="line"><a id="l00146" name="l00146"></a><span class="lineno"> 146</span> </div>
- <div class="line"><a id="l00147" name="l00147"></a><span class="lineno"> 147</span> <span class="keywordflow">return</span> ApplyVelocityStep(ioBody1, ioBody2, lambda);</div>
- <div class="line"><a id="l00148" name="l00148"></a><span class="lineno"> 148</span> }</div>
- </div>
- <div class="line"><a id="l00149" name="l00149"></a><span class="lineno"> 149</span> </div>
- <div class="foldopen" id="foldopen00151" data-start="{" data-end="}">
- <div class="line"><a id="l00151" name="l00151"></a><span class="lineno"><a class="line" href="class_hinge_rotation_constraint_part.html#a0f4c769c027f4efb2511d74f9658d8eb"> 151</a></span> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code hl_function" href="class_hinge_rotation_constraint_part.html#a0f4c769c027f4efb2511d74f9658d8eb">SolvePositionConstraint</a>(<a class="code hl_class" href="class_body.html">Body</a> &ioBody1, <a class="code hl_class" href="class_body.html">Body</a> &ioBody2, <span class="keywordtype">float</span> inBaumgarte)<span class="keyword"> const</span></div>
- <div class="line"><a id="l00152" name="l00152"></a><span class="lineno"> 152</span><span class="keyword"> </span>{</div>
- <div class="line"><a id="l00153" name="l00153"></a><span class="lineno"> 153</span> <span class="comment">// Constraint needs Axis of body 1 perpendicular to both B and C from body 2 (which are both perpendicular to the Axis of body 2)</span></div>
- <div class="line"><a id="l00154" name="l00154"></a><span class="lineno"> 154</span> <a class="code hl_class" href="class_vector.html">Vec2</a> c;</div>
- <div class="line"><a id="l00155" name="l00155"></a><span class="lineno"> 155</span> c[0] = mA1.<a class="code hl_function" href="class_vec3.html#a0e078ff09f69e669db71a2b0e37939ff">Dot</a>(mB2);</div>
- <div class="line"><a id="l00156" name="l00156"></a><span class="lineno"> 156</span> c[1] = mA1.<a class="code hl_function" href="class_vec3.html#a0e078ff09f69e669db71a2b0e37939ff">Dot</a>(mC2);</div>
- <div class="line"><a id="l00157" name="l00157"></a><span class="lineno"> 157</span> <span class="keywordflow">if</span> (!c.<a class="code hl_function" href="class_vector.html#ab1368364228755bfe9e64af3654ea995">IsZero</a>())</div>
- <div class="line"><a id="l00158" name="l00158"></a><span class="lineno"> 158</span> {</div>
- <div class="line"><a id="l00159" name="l00159"></a><span class="lineno"> 159</span> <span class="comment">// Calculate lagrange multiplier (lambda) for Baumgarte stabilization:</span></div>
- <div class="line"><a id="l00160" name="l00160"></a><span class="lineno"> 160</span> <span class="comment">//</span></div>
- <div class="line"><a id="l00161" name="l00161"></a><span class="lineno"> 161</span> <span class="comment">// lambda = -K^-1 * beta / dt * C</span></div>
- <div class="line"><a id="l00162" name="l00162"></a><span class="lineno"> 162</span> <span class="comment">//</span></div>
- <div class="line"><a id="l00163" name="l00163"></a><span class="lineno"> 163</span> <span class="comment">// We should divide by inDeltaTime, but we should multiply by inDeltaTime in the Euler step below so they're cancelled out</span></div>
- <div class="line"><a id="l00164" name="l00164"></a><span class="lineno"> 164</span> <a class="code hl_class" href="class_vector.html">Vec2</a> lambda = -inBaumgarte * (mEffectiveMass * c);</div>
- <div class="line"><a id="l00165" name="l00165"></a><span class="lineno"> 165</span> </div>
- <div class="line"><a id="l00166" name="l00166"></a><span class="lineno"> 166</span> <span class="comment">// Directly integrate velocity change for one time step</span></div>
- <div class="line"><a id="l00167" name="l00167"></a><span class="lineno"> 167</span> <span class="comment">//</span></div>
- <div class="line"><a id="l00168" name="l00168"></a><span class="lineno"> 168</span> <span class="comment">// Euler velocity integration:</span></div>
- <div class="line"><a id="l00169" name="l00169"></a><span class="lineno"> 169</span> <span class="comment">// dv = M^-1 P</span></div>
- <div class="line"><a id="l00170" name="l00170"></a><span class="lineno"> 170</span> <span class="comment">//</span></div>
- <div class="line"><a id="l00171" name="l00171"></a><span class="lineno"> 171</span> <span class="comment">// Impulse:</span></div>
- <div class="line"><a id="l00172" name="l00172"></a><span class="lineno"> 172</span> <span class="comment">// P = J^T lambda</span></div>
- <div class="line"><a id="l00173" name="l00173"></a><span class="lineno"> 173</span> <span class="comment">//</span></div>
- <div class="line"><a id="l00174" name="l00174"></a><span class="lineno"> 174</span> <span class="comment">// Euler position integration:</span></div>
- <div class="line"><a id="l00175" name="l00175"></a><span class="lineno"> 175</span> <span class="comment">// x' = x + dv * dt</span></div>
- <div class="line"><a id="l00176" name="l00176"></a><span class="lineno"> 176</span> <span class="comment">//</span></div>
- <div class="line"><a id="l00177" name="l00177"></a><span class="lineno"> 177</span> <span class="comment">// Note we don't accumulate velocities for the stabilization. This is using the approach described in 'Modeling and</span></div>
- <div class="line"><a id="l00178" name="l00178"></a><span class="lineno"> 178</span> <span class="comment">// Solving Constraints' by Erin Catto presented at GDC 2007. On slide 78 it is suggested to split up the Baumgarte</span></div>
- <div class="line"><a id="l00179" name="l00179"></a><span class="lineno"> 179</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>
- <div class="line"><a id="l00180" name="l00180"></a><span class="lineno"> 180</span> <span class="comment">// integrate + a position integrate and then discard the velocity change.</span></div>
- <div class="line"><a id="l00181" name="l00181"></a><span class="lineno"> 181</span> <a class="code hl_class" href="class_vec3.html">Vec3</a> impulse = mB2xA1 * lambda[0] + mC2xA1 * lambda[1];</div>
- <div class="line"><a id="l00182" name="l00182"></a><span class="lineno"> 182</span> <span class="keywordflow">if</span> (ioBody1.<a class="code hl_function" href="class_body.html#a1b21c30907c8c9ce30c176a054057bef">IsDynamic</a>())</div>
- <div class="line"><a id="l00183" name="l00183"></a><span class="lineno"> 183</span> ioBody1.<a class="code hl_function" href="class_body.html#ab0df53d82e3a8356fac91d178b30c369">SubRotationStep</a>(mInvI1.<a class="code hl_function" href="class_mat44.html#ab599aaeab3e4b832f7f4097816650b14">Multiply3x3</a>(impulse));</div>
- <div class="line"><a id="l00184" name="l00184"></a><span class="lineno"> 184</span> <span class="keywordflow">if</span> (ioBody2.<a class="code hl_function" href="class_body.html#a1b21c30907c8c9ce30c176a054057bef">IsDynamic</a>())</div>
- <div class="line"><a id="l00185" name="l00185"></a><span class="lineno"> 185</span> ioBody2.<a class="code hl_function" href="class_body.html#a3385650a73d75c7d9c16d13ea2d5519f">AddRotationStep</a>(mInvI2.<a class="code hl_function" href="class_mat44.html#ab599aaeab3e4b832f7f4097816650b14">Multiply3x3</a>(impulse));</div>
- <div class="line"><a id="l00186" name="l00186"></a><span class="lineno"> 186</span> <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
- <div class="line"><a id="l00187" name="l00187"></a><span class="lineno"> 187</span> }</div>
- <div class="line"><a id="l00188" name="l00188"></a><span class="lineno"> 188</span> </div>
- <div class="line"><a id="l00189" name="l00189"></a><span class="lineno"> 189</span> <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
- <div class="line"><a id="l00190" name="l00190"></a><span class="lineno"> 190</span> }</div>
- </div>
- <div class="line"><a id="l00191" name="l00191"></a><span class="lineno"> 191</span> </div>
- <div class="foldopen" id="foldopen00193" data-start="{" data-end="}">
- <div class="line"><a id="l00193" name="l00193"></a><span class="lineno"><a class="line" href="class_hinge_rotation_constraint_part.html#aa99c7f68df35ac1e3bef098c7e20225b"> 193</a></span> <span class="keyword">const</span> <a class="code hl_class" href="class_vector.html">Vec2</a> & <a class="code hl_function" href="class_hinge_rotation_constraint_part.html#aa99c7f68df35ac1e3bef098c7e20225b">GetTotalLambda</a>()<span class="keyword"> const</span></div>
- <div class="line"><a id="l00194" name="l00194"></a><span class="lineno"> 194</span><span class="keyword"> </span>{</div>
- <div class="line"><a id="l00195" name="l00195"></a><span class="lineno"> 195</span> <span class="keywordflow">return</span> mTotalLambda;</div>
- <div class="line"><a id="l00196" name="l00196"></a><span class="lineno"> 196</span> }</div>
- </div>
- <div class="line"><a id="l00197" name="l00197"></a><span class="lineno"> 197</span> </div>
- <div class="foldopen" id="foldopen00199" data-start="{" data-end="}">
- <div class="line"><a id="l00199" name="l00199"></a><span class="lineno"><a class="line" href="class_hinge_rotation_constraint_part.html#aa35cc45b0e9cfbb7063508e24c677879"> 199</a></span> <span class="keywordtype">void</span> <a class="code hl_function" href="class_hinge_rotation_constraint_part.html#aa35cc45b0e9cfbb7063508e24c677879">SaveState</a>(<a class="code hl_class" href="class_state_recorder.html">StateRecorder</a> &inStream)<span class="keyword"> const</span></div>
- <div class="line"><a id="l00200" name="l00200"></a><span class="lineno"> 200</span><span class="keyword"> </span>{</div>
- <div class="line"><a id="l00201" name="l00201"></a><span class="lineno"> 201</span> inStream.<a class="code hl_function" href="class_stream_out.html#a879dce6c6c6ca5e63835fe61cc745966">Write</a>(mTotalLambda);</div>
- <div class="line"><a id="l00202" name="l00202"></a><span class="lineno"> 202</span> }</div>
- </div>
- <div class="line"><a id="l00203" name="l00203"></a><span class="lineno"> 203</span> </div>
- <div class="foldopen" id="foldopen00205" data-start="{" data-end="}">
- <div class="line"><a id="l00205" name="l00205"></a><span class="lineno"><a class="line" href="class_hinge_rotation_constraint_part.html#abf5e533e782c69c89481e4bf6e3a0a28"> 205</a></span> <span class="keywordtype">void</span> <a class="code hl_function" href="class_hinge_rotation_constraint_part.html#abf5e533e782c69c89481e4bf6e3a0a28">RestoreState</a>(<a class="code hl_class" href="class_state_recorder.html">StateRecorder</a> &inStream)</div>
- <div class="line"><a id="l00206" name="l00206"></a><span class="lineno"> 206</span> {</div>
- <div class="line"><a id="l00207" name="l00207"></a><span class="lineno"> 207</span> inStream.<a class="code hl_function" href="class_stream_in.html#a5ae9304c310edfc5ef1c67a95e36b1f3">Read</a>(mTotalLambda);</div>
- <div class="line"><a id="l00208" name="l00208"></a><span class="lineno"> 208</span> }</div>
- </div>
- <div class="line"><a id="l00209" name="l00209"></a><span class="lineno"> 209</span> </div>
- <div class="line"><a id="l00210" name="l00210"></a><span class="lineno"> 210</span><span class="keyword">private</span>:</div>
- <div class="line"><a id="l00211" name="l00211"></a><span class="lineno"> 211</span> <a class="code hl_class" href="class_vec3.html">Vec3</a> mA1; </div>
- <div class="line"><a id="l00212" name="l00212"></a><span class="lineno"> 212</span> <a class="code hl_class" href="class_vec3.html">Vec3</a> mB2; </div>
- <div class="line"><a id="l00213" name="l00213"></a><span class="lineno"> 213</span> <a class="code hl_class" href="class_vec3.html">Vec3</a> mC2;</div>
- <div class="line"><a id="l00214" name="l00214"></a><span class="lineno"> 214</span> <a class="code hl_class" href="class_mat44.html">Mat44</a> mInvI1;</div>
- <div class="line"><a id="l00215" name="l00215"></a><span class="lineno"> 215</span> <a class="code hl_class" href="class_mat44.html">Mat44</a> mInvI2;</div>
- <div class="line"><a id="l00216" name="l00216"></a><span class="lineno"> 216</span> <a class="code hl_class" href="class_vec3.html">Vec3</a> mB2xA1;</div>
- <div class="line"><a id="l00217" name="l00217"></a><span class="lineno"> 217</span> <a class="code hl_class" href="class_vec3.html">Vec3</a> mC2xA1;</div>
- <div class="line"><a id="l00218" name="l00218"></a><span class="lineno"> 218</span> <a class="code hl_typedef" href="class_hinge_rotation_constraint_part.html#ab1f18a0c76566111d337d6d175b8bbc6">Mat22</a> mEffectiveMass;</div>
- <div class="line"><a id="l00219" name="l00219"></a><span class="lineno"> 219</span> <a class="code hl_typedef" href="class_hinge_rotation_constraint_part.html#ac0464fe586004502d840466631aaa7b0">Vec2</a> mTotalLambda { <a class="code hl_function" href="class_vector.html#ae70acad7587a3fa83a27f2ece2ba79b8">Vec2::sZero</a>() };</div>
- <div class="line"><a id="l00220" name="l00220"></a><span class="lineno"> 220</span>};</div>
- </div>
- <div class="line"><a id="l00221" name="l00221"></a><span class="lineno"> 221</span> </div>
- <div class="line"><a id="l00222" name="l00222"></a><span class="lineno"> 222</span><a class="code hl_define" href="_core_8h.html#a73da8725998b00321a9db341202d650d">JPH_NAMESPACE_END</a></div>
- <div class="ttc" id="a_body_8h_html"><div class="ttname"><a href="_body_8h.html">Body.h</a></div></div>
- <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>
- <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>
- <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>
- <div class="ttc" id="a_matrix_8h_html"><div class="ttname"><a href="_matrix_8h.html">Matrix.h</a></div></div>
- <div class="ttc" id="a_state_recorder_8h_html"><div class="ttname"><a href="_state_recorder_8h.html">StateRecorder.h</a></div></div>
- <div class="ttc" id="a_vector_8h_html"><div class="ttname"><a href="_vector_8h.html">Vector.h</a></div></div>
- <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>
- <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>
- <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>
- <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 & constraint solving)</div><div class="ttdef"><b>Definition</b> Body.inl:81</div></div>
- <div class="ttc" id="aclass_body_html_ab0df53d82e3a8356fac91d178b30c369"><div class="ttname"><a href="class_body.html#ab0df53d82e3a8356fac91d178b30c369">Body::SubRotationStep</a></div><div class="ttdeci">void SubRotationStep(Vec3Arg inAngularVelocityTimesDeltaTime)</div><div class="ttdef"><b>Definition</b> Body.inl:100</div></div>
- <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>
- <div class="ttc" id="aclass_hinge_rotation_constraint_part_html"><div class="ttname"><a href="class_hinge_rotation_constraint_part.html">HingeRotationConstraintPart</a></div><div class="ttdef"><b>Definition</b> HingeRotationConstraintPart.h:44</div></div>
- <div class="ttc" id="aclass_hinge_rotation_constraint_part_html_a0f4c769c027f4efb2511d74f9658d8eb"><div class="ttname"><a href="class_hinge_rotation_constraint_part.html#a0f4c769c027f4efb2511d74f9658d8eb">HingeRotationConstraintPart::SolvePositionConstraint</a></div><div class="ttdeci">bool SolvePositionConstraint(Body &ioBody1, Body &ioBody2, float inBaumgarte) const</div><div class="ttdoc">Iteratively update the position constraint. Makes sure C(...) = 0.</div><div class="ttdef"><b>Definition</b> HingeRotationConstraintPart.h:151</div></div>
- <div class="ttc" id="aclass_hinge_rotation_constraint_part_html_a41471ce4cbe4f3b915ba40f883a3f924"><div class="ttname"><a href="class_hinge_rotation_constraint_part.html#a41471ce4cbe4f3b915ba40f883a3f924">HingeRotationConstraintPart::CalculateConstraintProperties</a></div><div class="ttdeci">void CalculateConstraintProperties(const Body &inBody1, Mat44Arg inRotation1, Vec3Arg inWorldSpaceHingeAxis1, const Body &inBody2, Mat44Arg inRotation2, Vec3Arg inWorldSpaceHingeAxis2)</div><div class="ttdoc">Calculate properties used during the functions below.</div><div class="ttdef"><b>Definition</b> HingeRotationConstraintPart.h:76</div></div>
- <div class="ttc" id="aclass_hinge_rotation_constraint_part_html_a4ae072cae1beb84f1e87eafff60f0022"><div class="ttname"><a href="class_hinge_rotation_constraint_part.html#a4ae072cae1beb84f1e87eafff60f0022">HingeRotationConstraintPart::Deactivate</a></div><div class="ttdeci">void Deactivate()</div><div class="ttdoc">Deactivate this constraint.</div><div class="ttdef"><b>Definition</b> HingeRotationConstraintPart.h:119</div></div>
- <div class="ttc" id="aclass_hinge_rotation_constraint_part_html_aa35cc45b0e9cfbb7063508e24c677879"><div class="ttname"><a href="class_hinge_rotation_constraint_part.html#aa35cc45b0e9cfbb7063508e24c677879">HingeRotationConstraintPart::SaveState</a></div><div class="ttdeci">void SaveState(StateRecorder &inStream) const</div><div class="ttdoc">Save state of this constraint part.</div><div class="ttdef"><b>Definition</b> HingeRotationConstraintPart.h:199</div></div>
- <div class="ttc" id="aclass_hinge_rotation_constraint_part_html_aa71c15ea49da0d82a70d8edf787f612b"><div class="ttname"><a href="class_hinge_rotation_constraint_part.html#aa71c15ea49da0d82a70d8edf787f612b">HingeRotationConstraintPart::WarmStart</a></div><div class="ttdeci">void WarmStart(Body &ioBody1, Body &ioBody2, float inWarmStartImpulseRatio)</div><div class="ttdoc">Must be called from the WarmStartVelocityConstraint call to apply the previous frame's impulses.</div><div class="ttdef"><b>Definition</b> HingeRotationConstraintPart.h:126</div></div>
- <div class="ttc" id="aclass_hinge_rotation_constraint_part_html_aa99c7f68df35ac1e3bef098c7e20225b"><div class="ttname"><a href="class_hinge_rotation_constraint_part.html#aa99c7f68df35ac1e3bef098c7e20225b">HingeRotationConstraintPart::GetTotalLambda</a></div><div class="ttdeci">const Vec2 & GetTotalLambda() const</div><div class="ttdoc">Return lagrange multiplier.</div><div class="ttdef"><b>Definition</b> HingeRotationConstraintPart.h:193</div></div>
- <div class="ttc" id="aclass_hinge_rotation_constraint_part_html_aabd46260672295ed6df506bf81a2f326"><div class="ttname"><a href="class_hinge_rotation_constraint_part.html#aabd46260672295ed6df506bf81a2f326">HingeRotationConstraintPart::SolveVelocityConstraint</a></div><div class="ttdeci">bool SolveVelocityConstraint(Body &ioBody1, Body &ioBody2)</div><div class="ttdoc">Iteratively update the velocity constraint. Makes sure d/dt C(...) = 0, where C is the constraint equ...</div><div class="ttdef"><b>Definition</b> HingeRotationConstraintPart.h:133</div></div>
- <div class="ttc" id="aclass_hinge_rotation_constraint_part_html_ab1f18a0c76566111d337d6d175b8bbc6"><div class="ttname"><a href="class_hinge_rotation_constraint_part.html#ab1f18a0c76566111d337d6d175b8bbc6">HingeRotationConstraintPart::Mat22</a></div><div class="ttdeci">Matrix< 2, 2 > Mat22</div><div class="ttdef"><b>Definition</b> HingeRotationConstraintPart.h:47</div></div>
- <div class="ttc" id="aclass_hinge_rotation_constraint_part_html_abf5e533e782c69c89481e4bf6e3a0a28"><div class="ttname"><a href="class_hinge_rotation_constraint_part.html#abf5e533e782c69c89481e4bf6e3a0a28">HingeRotationConstraintPart::RestoreState</a></div><div class="ttdeci">void RestoreState(StateRecorder &inStream)</div><div class="ttdoc">Restore state of this constraint part.</div><div class="ttdef"><b>Definition</b> HingeRotationConstraintPart.h:205</div></div>
- <div class="ttc" id="aclass_hinge_rotation_constraint_part_html_ac0464fe586004502d840466631aaa7b0"><div class="ttname"><a href="class_hinge_rotation_constraint_part.html#ac0464fe586004502d840466631aaa7b0">HingeRotationConstraintPart::Vec2</a></div><div class="ttdeci">Vector< 2 > Vec2</div><div class="ttdef"><b>Definition</b> HingeRotationConstraintPart.h:46</div></div>
- <div class="ttc" id="aclass_mat44_html"><div class="ttname"><a href="class_mat44.html">Mat44</a></div><div class="ttdoc">Holds a 4x4 matrix of floats, but supports also operations on the 3x3 upper left part of the matrix.</div><div class="ttdef"><b>Definition</b> Mat44.h:13</div></div>
- <div class="ttc" id="aclass_mat44_html_a1e3a8da1cf3a631ffaf478ca3f6bb1ed"><div class="ttname"><a href="class_mat44.html#a1e3a8da1cf3a631ffaf478ca3f6bb1ed">Mat44::sZero</a></div><div class="ttdeci">static JPH_INLINE Mat44 sZero()</div><div class="ttdoc">Zero matrix.</div><div class="ttdef"><b>Definition</b> Mat44.inl:30</div></div>
- <div class="ttc" id="aclass_mat44_html_ab599aaeab3e4b832f7f4097816650b14"><div class="ttname"><a href="class_mat44.html#ab599aaeab3e4b832f7f4097816650b14">Mat44::Multiply3x3</a></div><div class="ttdeci">JPH_INLINE Vec3 Multiply3x3(Vec3Arg inV) const</div><div class="ttdoc">Multiply vector by only 3x3 part of the matrix.</div><div class="ttdef"><b>Definition</b> Mat44.inl:316</div></div>
- <div class="ttc" id="aclass_matrix_html"><div class="ttname"><a href="class_matrix.html">Matrix< 2, 2 ></a></div></div>
- <div class="ttc" id="aclass_matrix_html_a1e2531318f995ae102d4428c3bdba738"><div class="ttname"><a href="class_matrix.html#a1e2531318f995ae102d4428c3bdba738">Matrix::SetInversed</a></div><div class="ttdeci">bool SetInversed(const Matrix &inM)</div><div class="ttdoc">Inverse matrix.</div><div class="ttdef"><b>Definition</b> Matrix.h:200</div></div>
- <div class="ttc" id="aclass_matrix_html_a7b98e3c672cc83e50b0cb6cf33b1ec65"><div class="ttname"><a href="class_matrix.html#a7b98e3c672cc83e50b0cb6cf33b1ec65">Matrix::SetZero</a></div><div class="ttdeci">void SetZero()</div><div class="ttdoc">Zero matrix.</div><div class="ttdef"><b>Definition</b> Matrix.h:26</div></div>
- <div class="ttc" id="aclass_motion_properties_html_a98672fc0c6884643944e570e1d78ac07"><div class="ttname"><a href="class_motion_properties.html#a98672fc0c6884643944e570e1d78ac07">MotionProperties::SubAngularVelocityStep</a></div><div class="ttdeci">void SubAngularVelocityStep(Vec3Arg inAngularVelocityChange)</div><div class="ttdef"><b>Definition</b> MotionProperties.h:220</div></div>
- <div class="ttc" id="aclass_motion_properties_html_ab95f2b1c9b6bd9b6082f8cee8a7e1858"><div class="ttname"><a href="class_motion_properties.html#ab95f2b1c9b6bd9b6082f8cee8a7e1858">MotionProperties::GetInverseInertiaForRotation</a></div><div class="ttdeci">Mat44 GetInverseInertiaForRotation(Mat44Arg inRotation) const</div><div class="ttdoc">Get inverse inertia matrix ( ) for a given object rotation (translation will be ignored)....</div><div class="ttdef"><b>Definition</b> MotionProperties.inl:69</div></div>
- <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>
- <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>
- <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 &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>
- <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 &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>
- <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>
- <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>
- <div class="ttc" id="aclass_vec3_html_a0f7559f2691ad67826f42ca19916b7a9"><div class="ttname"><a href="class_vec3.html#a0f7559f2691ad67826f42ca19916b7a9">Vec3::Normalized</a></div><div class="ttdeci">JPH_INLINE Vec3 Normalized() const</div><div class="ttdoc">Normalize vector.</div><div class="ttdef"><b>Definition</b> Vec3.inl:707</div></div>
- <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>
- <div class="ttc" id="aclass_vec3_html_a24a96972fdbe04ae9a3e340fd4c39b81"><div class="ttname"><a href="class_vec3.html#a24a96972fdbe04ae9a3e340fd4c39b81">Vec3::GetNormalizedPerpendicular</a></div><div class="ttdeci">JPH_INLINE Vec3 GetNormalizedPerpendicular() const</div><div class="ttdoc">Get normalized vector that is perpendicular to this vector.</div><div class="ttdef"><b>Definition</b> Vec3.inl:827</div></div>
- <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>
- <div class="ttc" id="aclass_vec3_html_aba501a6a474028084799f871c9083dc1"><div class="ttname"><a href="class_vec3.html#aba501a6a474028084799f871c9083dc1">Vec3::LengthSq</a></div><div class="ttdeci">JPH_INLINE float LengthSq() const</div><div class="ttdoc">Squared length of vector.</div><div class="ttdef"><b>Definition</b> Vec3.inl:666</div></div>
- <div class="ttc" id="aclass_vector_html"><div class="ttname"><a href="class_vector.html">Vector< 2 ></a></div></div>
- <div class="ttc" id="aclass_vector_html_a06ffa8aa3d40e7c93dde19725e77ff3a"><div class="ttname"><a href="class_vector.html#a06ffa8aa3d40e7c93dde19725e77ff3a">Vector::SetZero</a></div><div class="ttdeci">void SetZero()</div><div class="ttdoc">Vector with all zeros.</div><div class="ttdef"><b>Definition</b> Vector.h:22</div></div>
- <div class="ttc" id="aclass_vector_html_ab1368364228755bfe9e64af3654ea995"><div class="ttname"><a href="class_vector.html#ab1368364228755bfe9e64af3654ea995">Vector::IsZero</a></div><div class="ttdeci">bool IsZero() const</div><div class="ttdoc">Test if vector consists of all zeros.</div><div class="ttdef"><b>Definition</b> Vector.h:69</div></div>
- <div class="ttc" id="aclass_vector_html_ae70acad7587a3fa83a27f2ece2ba79b8"><div class="ttname"><a href="class_vector.html#ae70acad7587a3fa83a27f2ece2ba79b8">Vector< 2 >::sZero</a></div><div class="ttdeci">static Vector sZero()</div><div class="ttdef"><b>Definition</b> Vector.h:28</div></div>
- </div><!-- fragment --></div><!-- contents -->
- </div><!-- doc-content -->
- <!-- start footer part -->
- <div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
- <ul>
- <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="_hinge_rotation_constraint_part_8h.html">HingeRotationConstraintPart.h</a></li>
- <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>
- </ul>
- </div>
- </body>
- </html>
|