_estimate_collision_response_8cpp.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  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/Collision/EstimateCollisionResponse.cpp File Reference</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('_estimate_collision_response_8cpp.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="summary">
  107. <a href="#func-members">Functions</a> </div>
  108. <div class="headertitle"><div class="title">EstimateCollisionResponse.cpp File Reference</div></div>
  109. </div><!--header-->
  110. <div class="contents">
  111. <div class="textblock"><code>#include &lt;<a class="el" href="_jolt_8h_source.html">Jolt/Jolt.h</a>&gt;</code><br />
  112. <code>#include &lt;<a class="el" href="_estimate_collision_response_8h_source.html">Jolt/Physics/Collision/EstimateCollisionResponse.h</a>&gt;</code><br />
  113. <code>#include &lt;<a class="el" href="_body_8h_source.html">Jolt/Physics/Body/Body.h</a>&gt;</code><br />
  114. </div><table class="memberdecls">
  115. <tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
  116. Functions</h2></td></tr>
  117. <tr class="memitem:a64da30a754090f2e72e7cb37b55b035f" id="r_a64da30a754090f2e72e7cb37b55b035f"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_core_8h.html#ad14098b68b8c44ea6112601031268405">JPH_NAMESPACE_BEGIN</a> void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a64da30a754090f2e72e7cb37b55b035f">EstimateCollisionResponse</a> (const <a class="el" href="class_body.html">Body</a> &amp;inBody1, const <a class="el" href="class_body.html">Body</a> &amp;inBody2, const <a class="el" href="class_contact_manifold.html">ContactManifold</a> &amp;inManifold, <a class="el" href="struct_collision_estimation_result.html">CollisionEstimationResult</a> &amp;outResult, float inCombinedFriction, float inCombinedRestitution, float inMinVelocityForRestitution, <a class="el" href="_core_8h.html#a69aa29b598b851b0640aa225a9e5d61d">uint</a> inNumIterations)</td></tr>
  118. <tr class="separator:a64da30a754090f2e72e7cb37b55b035f"><td class="memSeparator" colspan="2">&#160;</td></tr>
  119. </table>
  120. <h2 class="groupheader">Function Documentation</h2>
  121. <a id="a64da30a754090f2e72e7cb37b55b035f" name="a64da30a754090f2e72e7cb37b55b035f"></a>
  122. <h2 class="memtitle"><span class="permalink"><a href="#a64da30a754090f2e72e7cb37b55b035f">&#9670;&#160;</a></span>EstimateCollisionResponse()</h2>
  123. <div class="memitem">
  124. <div class="memproto">
  125. <table class="memname">
  126. <tr>
  127. <td class="memname"><a class="el" href="_core_8h.html#ad14098b68b8c44ea6112601031268405">JPH_NAMESPACE_BEGIN</a> void EstimateCollisionResponse </td>
  128. <td>(</td>
  129. <td class="paramtype">const <a class="el" href="class_body.html">Body</a> &amp;</td> <td class="paramname"><span class="paramname"><em>inBody1</em></span>, </td>
  130. </tr>
  131. <tr>
  132. <td class="paramkey"></td>
  133. <td></td>
  134. <td class="paramtype">const <a class="el" href="class_body.html">Body</a> &amp;</td> <td class="paramname"><span class="paramname"><em>inBody2</em></span>, </td>
  135. </tr>
  136. <tr>
  137. <td class="paramkey"></td>
  138. <td></td>
  139. <td class="paramtype">const <a class="el" href="class_contact_manifold.html">ContactManifold</a> &amp;</td> <td class="paramname"><span class="paramname"><em>inManifold</em></span>, </td>
  140. </tr>
  141. <tr>
  142. <td class="paramkey"></td>
  143. <td></td>
  144. <td class="paramtype"><a class="el" href="struct_collision_estimation_result.html">CollisionEstimationResult</a> &amp;</td> <td class="paramname"><span class="paramname"><em>outResult</em></span>, </td>
  145. </tr>
  146. <tr>
  147. <td class="paramkey"></td>
  148. <td></td>
  149. <td class="paramtype">float</td> <td class="paramname"><span class="paramname"><em>inCombinedFriction</em></span>, </td>
  150. </tr>
  151. <tr>
  152. <td class="paramkey"></td>
  153. <td></td>
  154. <td class="paramtype">float</td> <td class="paramname"><span class="paramname"><em>inCombinedRestitution</em></span>, </td>
  155. </tr>
  156. <tr>
  157. <td class="paramkey"></td>
  158. <td></td>
  159. <td class="paramtype">float</td> <td class="paramname"><span class="paramname"><em>inMinVelocityForRestitution</em></span><span class="paramdefsep"> = </span><span class="paramdefval">1.0f</span>, </td>
  160. </tr>
  161. <tr>
  162. <td class="paramkey"></td>
  163. <td></td>
  164. <td class="paramtype"><a class="el" href="_core_8h.html#a69aa29b598b851b0640aa225a9e5d61d">uint</a></td> <td class="paramname"><span class="paramname"><em>inNumIterations</em></span><span class="paramdefsep"> = </span><span class="paramdefval">10</span>&#160;)</td>
  165. </tr>
  166. </table>
  167. </div><div class="memdoc">
  168. <p>This function estimates the contact impulses and body velocity changes as a result of a collision. It can be used in the <a class="el" href="class_contact_listener.html#aeb1d7908c8556ce24448ac572d7ad944">ContactListener::OnContactAdded</a> to determine the strength of the collision to e.g. play a sound or trigger a particle system. This function is accurate when two bodies collide but will not be accurate when more than 2 bodies collide at the same time as it does not know about these other collisions.</p>
  169. <dl class="params"><dt>Parameters</dt><dd>
  170. <table class="params">
  171. <tr><td class="paramname">inBody1</td><td>Colliding body 1 </td></tr>
  172. <tr><td class="paramname">inBody2</td><td>Colliding body 2 </td></tr>
  173. <tr><td class="paramname">inManifold</td><td>The collision manifold </td></tr>
  174. <tr><td class="paramname">outResult</td><td>A structure that contains the estimated contact and friction impulses and the resulting body velocities </td></tr>
  175. <tr><td class="paramname">inCombinedFriction</td><td>The combined friction of body 1 and body 2 (see <a class="el" href="class_contact_settings.html#a7a6722d38f6dd9f504412e3663400a2d" title="Combined friction for the body pair (see: PhysicsSystem::SetCombineFriction)">ContactSettings::mCombinedFriction</a>) </td></tr>
  176. <tr><td class="paramname">inCombinedRestitution</td><td>The combined restitution of body 1 and body 2 (see <a class="el" href="class_contact_settings.html#ade2482177e9dd9c8596a4a1cc6338979" title="Combined restitution for the body pair (see: PhysicsSystem::SetCombineRestitution)">ContactSettings::mCombinedRestitution</a>) </td></tr>
  177. <tr><td class="paramname">inMinVelocityForRestitution</td><td>Minimal velocity required for restitution to be applied (see <a class="el" href="struct_physics_settings.html#a3f68f35ad1244421ad126d3db5a617f3">PhysicsSettings::mMinVelocityForRestitution</a>) </td></tr>
  178. <tr><td class="paramname">inNumIterations</td><td>Number of iterations to use for the impulse estimation (see <a class="el" href="struct_physics_settings.html#a66af679ba7f202b402bb23d0a0e117ad">PhysicsSettings::mNumVelocitySteps</a>, note you can probably use a lower number for a decent estimate). If you set the number of iterations to 1 then no friction will be calculated. </td></tr>
  179. </table>
  180. </dd>
  181. </dl>
  182. </div>
  183. </div>
  184. </div><!-- contents -->
  185. </div><!-- doc-content -->
  186. <!-- start footer part -->
  187. <div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  188. <ul>
  189. <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_1a1d05ab9ff27ca8d1ed94cd62670cdf.html">Collision</a></li><li class="navelem"><a class="el" href="_estimate_collision_response_8cpp.html">EstimateCollisionResponse.cpp</a></li>
  190. <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>
  191. </ul>
  192. </div>
  193. </body>
  194. </html>