Skip to content

Commit

Permalink
added new demo and some APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
saharan committed Dec 31, 2017
1 parent 75629a7 commit 7e68bc3
Show file tree
Hide file tree
Showing 19 changed files with 125 additions and 52 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ A lightweight 3D physics engine.
* Direct block MLCP solver
* Projected Gauss-Seidel solver
* Sleepings with island splittings
* Limit rotations
* Collision event callbacks
* Collision filterings
* Collision queries
Expand Down
2 changes: 1 addition & 1 deletion bin/js/OimoPhysics.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/oimo/common/Transform.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
</style><nav class="nav"><div class="navbar"><div class="navbar-inner" style="background:#FAFAFA; border-bottom:1px solid rgba(0,0,0,.09)"><div class="container"><a class="brand" style="color:#000000" href="../../">OimoPhysics API documentation</a></div></div></div></nav><div class="container main-content"><div class="row-fluid"><div class="span3"><div class="well sidebar-nav"><form class="form-search" id="searchForm"><div class="input-prepend input-block-level"><span class="add-on"><i class="icon-search"></i></span><input id="search" type="text" placeholder="Search" autocomplete="off"/></div></form></div><div class="well sidebar-nav"><div id="nav"></div></div></div><div class="span9"><div class="page-header"><span class="viewsource"><a href="https://github.com/saharan/OimoPhysics/tree/master/src/oimo/common/Transform.hx" class="btn btn-medium"><i class="fa fa-eye"></i> View source</a></span><h1><small>class</small> Transform</h1><h4><small>package <a href="../../oimo/common/index.html">oimo.common</a></small></h4> </div><div class="body"><div class="doc doc-main"><div class="indent"><p>Transform class provides a set of translation and rotation.</p></div></div><h3 class="section">Constructor</h3><div class="fields"><div class="field "><a name="new"></a><h3><p><code><a href="#new"><span class="identifier">new</span></a> ()</code></p></h3><div class="doc"><p>Creates a new identical transform.</p></div></div></div><h3 class="section">Methods</h3><div class="fields"><div class="field "><a name="clone"></a><h3><p><code><span class="label">inline</span> <a href="#clone"><span class="identifier">clone</span></a> ():<a class="type" title="Transform class provides a set of translation and rotation." href="../../oimo/common/Transform.html">Transform</a></code></p></h3><div class="doc"><p>Returns a clone of the transformation.</p></div></div><div class="field "><a name="copyFrom"></a><h3><p><code><span class="label">inline</span> <a href="#copyFrom"><span class="identifier">copyFrom</span></a> (<span style="white-space:nowrap">transform:<a class="type" title="Transform class provides a set of translation and rotation." href="../../oimo/common/Transform.html">Transform</a></span>):<a class="type" title="Transform class provides a set of translation and rotation." href="../../oimo/common/Transform.html">Transform</a></code></p></h3><div class="doc"><p>Sets the transformation to <code>transform</code> and returns <code>this</code>.</p></div></div><div class="field "><a name="getOrientation"></a><h3><p><code><span class="label">inline</span> <a href="#getOrientation"><span class="identifier">getOrientation</span></a> ():<a class="type" title="Quaternion class." href="../../oimo/common/Quat.html">Quat</a></code></p></h3><div class="doc"><p>Returns the rotation as a quaternion.</p></div></div><div class="field "><a name="getOrientationTo"></a><h3><p><code><span class="label">inline</span> <a href="#getOrientationTo"><span class="identifier">getOrientationTo</span></a> (<span style="white-space:nowrap">orientation:<a class="type" title="Quaternion class." href="../../oimo/common/Quat.html">Quat</a></span>):<span class="type">Void</span></code></p></h3><div class="doc"><p>Sets <code>orientation</code> to the quaternion representing the rotation.</p>
<p>This does not create a new instance of <code><a href="../../oimo/common/Quat.html">Quat</a></code>.</p></div></div><div class="field "><a name="getPosition"></a><h3><p><code><span class="label">inline</span> <a href="#getPosition"><span class="identifier">getPosition</span></a> ():<a class="type" title="3D vector class." href="../../oimo/common/Vec3.html">Vec3</a></code></p></h3><div class="doc"><p>Returns the position of the transformation.</p></div></div><div class="field "><a name="getPositionTo"></a><h3><p><code><span class="label">inline</span> <a href="#getPositionTo"><span class="identifier">getPositionTo</span></a> (<span style="white-space:nowrap">position:<a class="type" title="3D vector class." href="../../oimo/common/Vec3.html">Vec3</a></span>):<span class="type">Void</span></code></p></h3><div class="doc"><p>Sets <code>position</code> to the position of the transformation.</p>
<p>This does not create a new instance of <code><a href="../../oimo/common/Vec3.html">Vec3</a></code>.</p></div></div><div class="field "><a name="getRotation"></a><h3><p><code><span class="label">inline</span> <a href="#getRotation"><span class="identifier">getRotation</span></a> ():<a class="type" title="3x3 Matrix class." href="../../oimo/common/Mat3.html">Mat3</a></code></p></h3><div class="doc"><p>Returns the rotation matrix.</p></div></div><div class="field "><a name="getRotationTo"></a><h3><p><code><span class="label">inline</span> <a href="#getRotationTo"><span class="identifier">getRotationTo</span></a> (<span style="white-space:nowrap">out:<a class="type" title="3x3 Matrix class." href="../../oimo/common/Mat3.html">Mat3</a></span>):<span class="type">Void</span></code></p></h3><div class="doc"><p>Sets <code>out</code> to the rotation matrix.</p>
<p>This does not create a new instance of <code><a href="../../oimo/common/Mat3.html">Mat3</a></code>.</p></div></div><div class="field "><a name="identity"></a><h3><p><code><span class="label">inline</span> <a href="#identity"><span class="identifier">identity</span></a> ():<a class="type" title="Transform class provides a set of translation and rotation." href="../../oimo/common/Transform.html">Transform</a></code></p></h3><div class="doc"><p>Sets the transformation to identity and returns <code>this</code>.</p></div></div><div class="field "><a name="rotate"></a><h3><p><code><span class="label">inline</span> <a href="#rotate"><span class="identifier">rotate</span></a> (<span style="white-space:nowrap">rotation:<a class="type" title="3x3 Matrix class." href="../../oimo/common/Mat3.html">Mat3</a></span>):<span class="type">Void</span></code></p></h3><div class="doc"><p>Applies rotation by the rotation matrix <code>rotation</code>.</p></div></div><div class="field "><a name="setOrientation"></a><h3><p><code><span class="label">inline</span> <a href="#setOrientation"><span class="identifier">setOrientation</span></a> (<span style="white-space:nowrap">quaternion:<a class="type" title="Quaternion class." href="../../oimo/common/Quat.html">Quat</a></span>):<a class="type" title="Transform class provides a set of translation and rotation." href="../../oimo/common/Transform.html">Transform</a></code></p></h3><div class="doc"><p>Sets the rotation from a quaternion <code>quaternion</code> and returns <code>this</code>.</p></div></div><div class="field "><a name="setPosition"></a><h3><p><code><span class="label">inline</span> <a href="#setPosition"><span class="identifier">setPosition</span></a> (<span style="white-space:nowrap">position:<a class="type" title="3D vector class." href="../../oimo/common/Vec3.html">Vec3</a></span>):<a class="type" title="Transform class provides a set of translation and rotation." href="../../oimo/common/Transform.html">Transform</a></code></p></h3><div class="doc"><p>Sets the position of the transformation to <code>position</code> and returns <code>this</code>.</p></div></div><div class="field "><a name="setRotation"></a><h3><p><code><span class="label">inline</span> <a href="#setRotation"><span class="identifier">setRotation</span></a> (<span style="white-space:nowrap">rotation:<a class="type" title="3x3 Matrix class." href="../../oimo/common/Mat3.html">Mat3</a></span>):<a class="type" title="Transform class provides a set of translation and rotation." href="../../oimo/common/Transform.html">Transform</a></code></p></h3><div class="doc"><p>Sets the rotation matrix to <code>rotation</code> and returns <code>this</code>.</p></div></div><div class="field "><a name="translate"></a><h3><p><code><span class="label">inline</span> <a href="#translate"><span class="identifier">translate</span></a> (<span style="white-space:nowrap">translation:<a class="type" title="3D vector class." href="../../oimo/common/Vec3.html">Vec3</a></span>):<span class="type">Void</span></code></p></h3><div class="doc"><p>Translates the position by <code>translation</code>.</p></div></div></div></div></div></div></div><footer class="section site-footer" style="background:#FAFAFA"><div class="container"><div class="copyright"><p style="color:#000000">This documentation is generated for version 1.0.0</p><p style="color:#000000">&copy; 2017 &nbsp;<a style="color:#000000" href="https://github.com/saharan/OimoPhysics">https://github.com/saharan/OimoPhysics</a></p></div></div></footer><script src="../..//highlighter.js"></script><link href="../../highlighter.css" rel="stylesheet"/></body></html>
<p>This does not create a new instance of <code><a href="../../oimo/common/Mat3.html">Mat3</a></code>.</p></div></div><div class="field "><a name="identity"></a><h3><p><code><span class="label">inline</span> <a href="#identity"><span class="identifier">identity</span></a> ():<a class="type" title="Transform class provides a set of translation and rotation." href="../../oimo/common/Transform.html">Transform</a></code></p></h3><div class="doc"><p>Sets the transformation to identity and returns <code>this</code>.</p></div></div><div class="field "><a name="rotate"></a><h3><p><code><span class="label">inline</span> <a href="#rotate"><span class="identifier">rotate</span></a> (<span style="white-space:nowrap">rotation:<a class="type" title="3x3 Matrix class." href="../../oimo/common/Mat3.html">Mat3</a></span>):<span class="type">Void</span></code></p></h3><div class="doc"><p>Applies rotation by the rotation matrix <code>rotation</code>.</p></div></div><div class="field "><a name="rotateXyz"></a><h3><p><code><span class="label">inline</span> <a href="#rotateXyz"><span class="identifier">rotateXyz</span></a> (<span style="white-space:nowrap">eulerAngles:<a class="type" title="3D vector class." href="../../oimo/common/Vec3.html">Vec3</a></span>):<span class="type">Void</span></code></p></h3><div class="doc"><p>Applies the rotation by Euler angles <code>eulerAngles</code> in radians.</p></div></div><div class="field "><a name="setOrientation"></a><h3><p><code><span class="label">inline</span> <a href="#setOrientation"><span class="identifier">setOrientation</span></a> (<span style="white-space:nowrap">quaternion:<a class="type" title="Quaternion class." href="../../oimo/common/Quat.html">Quat</a></span>):<a class="type" title="Transform class provides a set of translation and rotation." href="../../oimo/common/Transform.html">Transform</a></code></p></h3><div class="doc"><p>Sets the rotation from a quaternion <code>quaternion</code> and returns <code>this</code>.</p></div></div><div class="field "><a name="setPosition"></a><h3><p><code><span class="label">inline</span> <a href="#setPosition"><span class="identifier">setPosition</span></a> (<span style="white-space:nowrap">position:<a class="type" title="3D vector class." href="../../oimo/common/Vec3.html">Vec3</a></span>):<a class="type" title="Transform class provides a set of translation and rotation." href="../../oimo/common/Transform.html">Transform</a></code></p></h3><div class="doc"><p>Sets the position of the transformation to <code>position</code> and returns <code>this</code>.</p></div></div><div class="field "><a name="setRotation"></a><h3><p><code><span class="label">inline</span> <a href="#setRotation"><span class="identifier">setRotation</span></a> (<span style="white-space:nowrap">rotation:<a class="type" title="3x3 Matrix class." href="../../oimo/common/Mat3.html">Mat3</a></span>):<a class="type" title="Transform class provides a set of translation and rotation." href="../../oimo/common/Transform.html">Transform</a></code></p></h3><div class="doc"><p>Sets the rotation matrix to <code>rotation</code> and returns <code>this</code>.</p></div></div><div class="field "><a name="setRotationXyz"></a><h3><p><code><span class="label">inline</span> <a href="#setRotationXyz"><span class="identifier">setRotationXyz</span></a> (<span style="white-space:nowrap">eulerAngles:<a class="type" title="3D vector class." href="../../oimo/common/Vec3.html">Vec3</a></span>):<span class="type">Void</span></code></p></h3><div class="doc"><p>Sets the rotation by Euler angles <code>eulerAngles</code> in radians.</p></div></div><div class="field "><a name="translate"></a><h3><p><code><span class="label">inline</span> <a href="#translate"><span class="identifier">translate</span></a> (<span style="white-space:nowrap">translation:<a class="type" title="3D vector class." href="../../oimo/common/Vec3.html">Vec3</a></span>):<span class="type">Void</span></code></p></h3><div class="doc"><p>Translates the position by <code>translation</code>.</p></div></div></div></div></div></div></div><footer class="section site-footer" style="background:#FAFAFA"><div class="container"><div class="copyright"><p style="color:#000000">This documentation is generated for version 1.0.0</p><p style="color:#000000">&copy; 2017 &nbsp;<a style="color:#000000" href="https://github.com/saharan/OimoPhysics">https://github.com/saharan/OimoPhysics</a></p></div></div></footer><script src="../..//highlighter.js"></script><link href="../../highlighter.css" rel="stylesheet"/></body></html>
2 changes: 1 addition & 1 deletion docs/oimo/dynamics/rigidbody/RigidBody.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<p>If <code>0</code> is set, the rigid body will not be affected by gravity.</p></div></div><div class="field "><a name="setLinearVelocity"></a><h3><p><code><span class="label">inline</span> <a href="#setLinearVelocity"><span class="identifier">setLinearVelocity</span></a> (<span style="white-space:nowrap">linearVelocity:<a class="type" title="3D vector class." href="../../../oimo/common/Vec3.html">Vec3</a></span>):<span class="type">Void</span></code></p></h3><div class="doc"><p>Sets the linear velocity of the rigid body.</p></div></div><div class="field "><a name="setMassData"></a><h3><p><code><span class="label">inline</span> <a href="#setMassData"><span class="identifier">setMassData</span></a> (<span style="white-space:nowrap">massData:<a class="type" title="This class holds mass and moment of inertia for a rigid body." href="../../../oimo/dynamics/rigidbody/MassData.html">MassData</a></span>):<span class="type">Void</span></code></p></h3><div class="doc"><p>Sets the mass and moment of inertia of the rigid body by the mass data <code>massData</code>.
The properties set by this will be overwritten when</p><ul><li>some shapes are added or removed</li><li>the type of the rigid body is changed</li></ul></div></div><div class="field "><a name="setOrientation"></a><h3><p><code><span class="label">inline</span> <a href="#setOrientation"><span class="identifier">setOrientation</span></a> (<span style="white-space:nowrap">quaternion:<a class="type" title="Quaternion class." href="../../../oimo/common/Quat.html">Quat</a></span>):<span class="type">Void</span></code></p></h3><div class="doc"><p>Sets the rotation of the rigid body from a quaternion <code>quaternion</code>.</p></div></div><div class="field "><a name="setPosition"></a><h3><p><code><span class="label">inline</span> <a href="#setPosition"><span class="identifier">setPosition</span></a> (<span style="white-space:nowrap">position:<a class="type" title="3D vector class." href="../../../oimo/common/Vec3.html">Vec3</a></span>):<span class="type">Void</span></code></p></h3><div class="doc"><p>Sets the world position of the rigid body to <code>position</code>.</p></div></div><div class="field "><a name="setRotation"></a><h3><p><code><span class="label">inline</span> <a href="#setRotation"><span class="identifier">setRotation</span></a> (<span style="white-space:nowrap">rotation:<a class="type" title="3x3 Matrix class." href="../../../oimo/common/Mat3.html">Mat3</a></span>):<span class="type">Void</span></code></p></h3><div class="doc"><p>Sets the rotation matrix of the rigid body to <code>rotation</code>.</p></div></div><div class="field "><a name="setRotationFactor"></a><h3><p><code><span class="label">inline</span> <a href="#setRotationFactor"><span class="identifier">setRotationFactor</span></a> (<span style="white-space:nowrap">rotationFactor:<a class="type" title="3D vector class." href="../../../oimo/common/Vec3.html">Vec3</a></span>):<span class="type">Void</span></code></p></h3><div class="doc"><p>Sets the rotation factor of the rigid body to <code>rotationFactor</code>.</p>
<p>This changes moment of inertia internally, so that the change of
angular velocity in local space along X, Y and Z axis will scale by <code>rotationFactor.x</code>,
angular velocity in <strong>global space</strong> along X, Y and Z axis will scale by <code>rotationFactor.x</code>,
<code>rotationFactor.y</code> and <code>rotationFactor.z</code> times respectively.</p></div></div><div class="field "><a name="setRotationXyz"></a><h3><p><code><span class="label">inline</span> <a href="#setRotationXyz"><span class="identifier">setRotationXyz</span></a> (<span style="white-space:nowrap">eulerAngles:<a class="type" title="3D vector class." href="../../../oimo/common/Vec3.html">Vec3</a></span>):<span class="type">Void</span></code></p></h3><div class="doc"><p>Sets the rotation of the rigid body by Euler angles <code>eulerAngles</code> in radians.</p></div></div><div class="field "><a name="setTransform"></a><h3><p><code><span class="label">inline</span> <a href="#setTransform"><span class="identifier">setTransform</span></a> (<span style="white-space:nowrap">transform:<a class="type" title="Transform class provides a set of translation and rotation." href="../../../oimo/common/Transform.html">Transform</a></span>):<span class="type">Void</span></code></p></h3><div class="doc"><p>Sets the transform of the rigid body to <code>transform</code>.</p>
<p>This does not keep any references to <code>transform</code>.</p></div></div><div class="field "><a name="setType"></a><h3><p><code><a href="#setType"><span class="identifier">setType</span></a> (<span style="white-space:nowrap">type:<span class="type">Int</span></span>):<span class="type">Void</span></code></p></h3><div class="doc"><p>Sets the rigid body's type of behaviour.</p>
<p>See <code><a href="../../../oimo/dynamics/rigidbody/RigidBodyType.html">RigidBodyType</a></code> class for details.</p></div></div><div class="field "><a name="sleep"></a><h3><p><code><span class="label">inline</span> <a href="#sleep"><span class="identifier">sleep</span></a> ():<span class="type">Void</span></code></p></h3><div class="doc"><p>Sets the rigid body's sleep flag true.</p>
Expand Down
1 change: 1 addition & 0 deletions src/demo/common/DemoMain.hx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ class DemoMain {
new CollisionFilteringDemo(),
new ConvexHullDemo(),
new VerticalStackingDemo(),
new LimitRotationDemo(),
new BroadPhaseStressDemo(),
new BridgeDemo(),
new SpringsDemo(),
Expand Down

0 comments on commit 7e68bc3

Please sign in to comment.