📄 newton.htm
字号:
<td class=DefText>
friction model; 0 = exact coulomb, 1 = adaptive coulomb, The default is exact.
</td>
</tr>
</table>
<p>
<h4>Return</h4> Nothing.
<p> <h4>Remarks</h4> This function allows the application to chose between and exact or an adaptive coulomb friction model
<p> <h4>0</h4> Is the exact model. Friction forces are calculated in each frame.
This model is good for applications where precision is more important than speed, ex: realistic simulation.
<p> <h4>1</h4> Is the adaptive model. Here values from previous frames are used to determine the maximum friction values of the current frame.
This is about 10% faster than the exact model however it may introduce strange friction behaviors. For example a
bouncing object tumbling down a ramp will act as a friction less object because the contacts do not have continuity.
In general each time a new contact is generated the friction value is zero, only if the contact persist a non zero
friction values is used. The second effect is that if a normal force is very strong, and if the contact is suddenly
destroyed, a very strong friction force will be generated at the contact point making the object react in a non-familiar way.
<p> <h4>Remarks</h4> the adaptive friction model combined with the linear model make for the fastest possible configuration
of the Newton solver. This setup is best for games.
If you need the best realistic behavior, we recommend the use of the exact solver and exact friction model which are the defaults.
<p> <h4>See also</h4> <a HREF="#NewtonSetSolverModel">NewtonSetSolverModel</a>
</div>
</div>
<div class=Section>
<h3>
<a NAME="NewtonUpdate"></a>
<a NAME="NewtonUpdate"></a>
NewtonUpdate
</h3>
<div class=Api>
void <font class=ApiName>NewtonUpdate</font>(<br> const NewtonWorld* newtonWorld,<br> dFloat timestep)
</div>
<div class=SectionText>
Advance the simulation by an amount of time.
<p> <h4>Parameters</h4>
<p><table class=DefTable>
<tr class=Def>
<td class=Def>
<b>const NewtonWorld</b> *newtonWorld
</td>
<td class=DefSep>-</td>
<td class=DefText>
is the pointer to the Newton world
</td>
</tr>
<p>
<tr class=Def>
<td class=Def>
<b>dFloat</b> timestep
</td>
<td class=DefSep>-</td>
<td class=DefText>
time step in seconds
</td>
</tr>
</table>
<p>
<h4>Return</h4> Nothing
<p> <h4>Remarks</h4> This function will advance the simulation by the amount of time specified by <b>timestep</b>. The Newton Engine does
not perform sub-steps, and does not need tuning parameters. It is the responsibility of the application to
ensure that <b>timestep</b> is small enough to guarantee physics stability.
</div>
</div>
<div class=Section>
<h3>
<a NAME="NewtonSetMinimumFrameRate"></a>
<a NAME="NewtonSetMinimumFrameRate"></a>
NewtonSetMinimumFrameRate
</h3>
<div class=Api>
void <font class=ApiName>NewtonSetMinimumFrameRate</font>(<br> const NewtonWorld* newtonWorld,<br> dFloat frameRate)
</div>
<div class=SectionText>
Set the minimum frame rate at which the simulation can run.
<p> <h4>Parameters</h4>
<p><table class=DefTable>
<tr class=Def>
<td class=Def>
<b>const NewtonWorld</b> *newtonWorld
</td>
<td class=DefSep>-</td>
<td class=DefText>
is the pointer to the Newton world
</td>
</tr>
<p>
<tr class=Def>
<td class=Def>
<b>dFloat</b> frameRate
</td>
<td class=DefSep>-</td>
<td class=DefText>
minimum frame rate of the simulation in frame per second. This value is clamped between 60fps and 1000fps
</td>
</tr>
</table>
<p>
<h4>Return</h4> nothing
<p> <h4>Remarks</h4> the default minimum frame rate of the simulation is 60 frame per second. When the simulation falls below the specified minimum frame, Newton will
perform sub steps in order to meet the desired minimum FPS.
</div>
</div>
<div class=Section>
<h3>
<a NAME="NewtonGetTimeStep"></a>
<a NAME="NewtonGetTimeStep"></a>
NewtonGetTimeStep
</h3>
<div class=Api>
dFloat <font class=ApiName>NewtonGetTimeStep</font>(const NewtonWorld* newtonWorld)
</div>
<div class=SectionText>
Return the correct time step for this simulation update.
<p> <h4>Parameters</h4>
<p><table class=DefTable>
<tr class=Def>
<td class=Def>
<b>const NewtonWorld</b> *newtonWorld
</td>
<td class=DefSep>-</td>
<td class=DefText>
is the pointer to the Newton world.
</td>
</tr>
</table>
<p>
<h4>Remark</h4> This application can used this function to get the currect siulation time step.
<p> <h4>Return</h4> correct update timestep.
</div>
</div>
<div class=Section>
<h3>
<a NAME="NewtonDestroyAllBodies"></a>
<a NAME="NewtonDestroyAllBodies"></a>
NewtonDestroyAllBodies
</h3>
<div class=Api>
void <font class=ApiName>NewtonDestroyAllBodies</font>(const NewtonWorld* newtonWorld)
</div>
<div class=SectionText>
Remove all bodies and joints from the newton world.
<p> <h4>Parameters</h4>
<p><table class=DefTable>
<tr class=Def>
<td class=Def>
<b>const NewtonWorld</b> *newtonWorld
</td>
<td class=DefSep>-</td>
<td class=DefText>
is a pointer to the Newton world
</td>
</tr>
</table>
<p>
<h4>Return</h4> Nothing
<p> <h4>Remarks</h4> This function will destroy all bodies and all joints in the Newton world, but it will retain group IDs.
Use this function for when you want to clear the world but preserve all the group IDs and material pairs.
<p> <h4>See also</h4> <a HREF="#NewtonMaterialDestroyAllGroupID">NewtonMaterialDestroyAllGroupID</a>
</div>
</div>
<div class=Section>
<h3>
<a NAME="NewtonSetWorldSize"></a>
<a NAME="NewtonSetWorldSize"></a>
NewtonSetWorldSize
</h3>
<div class=Api>
void <font class=ApiName>NewtonSetWorldSize</font>(<br> const NewtonWorld* newtonWorld,<br> const dFloat* minPtr,<br> const dFloat* maxPtr)
</div>
<div class=SectionText>
Set the size of the Newton world.
<p> <h4>Parameters</h4>
<p><table class=DefTable>
<tr class=Def>
<td class=Def>
<b>const NewtonWorld</b> *newtonWorld
</td>
<td class=DefSep>-</td>
<td class=DefText>
is the pointer to the Newton world
</td>
</tr>
<p>
<tr class=Def>
<td class=Def>
<b>const dFloat</b> *minPtr
</td>
<td class=DefSep>-</td>
<td class=DefText>
is the minimum point of the world bounding box
</td>
</tr>
<p>
<tr class=Def>
<td class=Def>
<b>const dFloat</b> *maxPtr
</td>
<td class=DefSep>-</td>
<td class=DefText>
is the maximum point of the world bounding box
</td>
</tr>
</table>
<p>
<h4>Return</h4> Nothing.
<p> <h4>Remarks</h4> The Newton world must have a finite size. The size of the world is set to a box +- 100 units in all three dimensions
at creation time and after a call to the function <u>NewtonRemoveAllBodies</u>
<p> <h4>See also</h4> <a HREF="#NewtonSetBodyLeaveWorldEvent">NewtonSetBodyLeaveWorldEvent</a>
</div>
</div>
<div class=Section>
<h3>
<a NAME="NewtonSetBodyLeaveWorldEvent"></a>
<a NAME="NewtonSetBodyLeaveWorldEvent"></a>
NewtonSetBodyLeaveWorldEvent
</h3>
<div class=Api>
void <font class=ApiName>NewtonSetBodyLeaveWorldEvent</font>(<br> const NewtonWorld* newtonWorld,<br> NewtonBodyLeaveWorld callback)
</div>
<div class=SectionText>
Set the event callback function to be called in the event a body is escaping the limits of the world
during simulation time.
<p> <h4>Parameters</h4>
<p><table class=DefTable>
<tr class=Def>
<td class=Def>
<b>const NewtonWorld</b> *newtonWorld
</td>
<td class=DefSep>-</td>
<td class=DefText>
is the pointer to the Newton world
</td>
</tr>
<p>
<tr class=Def>
<td class=Def>
<b>NewtonBodyLeaveWorld</b> callback
</td>
<td class=DefSep>-</td>
<td class=DefText>
is the pointer to the function callback
</td>
</tr>
</table>
<p>
<h4>Return</h4> Nothing
<p> <h4>Remarks</h4> When a body moves outside the bounding box that defines the world space the body is automatically disabled
and Newton calls the application defined callback function <b>NewtonBodyLeaveWorld callback</b>.
The application should decide how to handle the event, because Newton will make the callback once.
The only options available to the application are: do nothing or destroy the object.
<p> <h4>Remarks</h4> if the application wants to reinitialize the body, it will have to used the function
<a HREF="#NewtonBodySetMatrixRecursive">NewtonBodySetMatrixRecursive</a>, this is because it is possible that the rigid body is part of a set of
articulate bodies and only one part leave the world while the others are still inside the world volume,
and in and situation like this the function NewtonSetMatrix will lead to unpredictable results.
<p> <h4>See also</h4> <a HREF="#NewtonSetWorldSize">NewtonSetWorldSize</a>, <a HREF="#NewtonBodySetMatrixRecursive">NewtonBodySetMatrixRecursive</a>
</div>
</div>
<div class=Section>
<h3>
<a NAME="NewtonWorldFreezeBody"></a>
<a NAME="NewtonWorldFreezeBody"></a>
NewtonWorldFreezeBody
</h3>
<div class=Api>
void <font class=ApiName>NewtonWorldFreezeBody</font>(<br> const NewtonWorld* newtonWorld,<br> const NewtonBody* body)
</div>
<div class=SectionText>
Remove the body from the active simulation list.
<p> <h4>Parameters</h4>
<p><table class=DefTable>
<tr class=Def>
<td class=Def>
<b>const NewtonWorld</b> *newtonWorld
</td>
<td class=DefSep>-</td>
<td class=DefText>
is the pointer to the Newton world
</td>
</tr>
<p>
<tr class=Def>
<td class=Def>
<b>const NewtonBody</b> *body
</td>
<td class=DefSep>-</td>
<td class=DefText>
is the pointer to the body to be frozen
</td>
</tr>
</table>
<p>
<h4>Return</h4> Nothing.
<p> <h4>Remarks</h4> When a body is created it is automatically placed in the active simulation list. As an optimization
for large scenes, you may use this function to put background bodies in an inactive equilibrium state.
<p> <h4>Remarks</h4> This function tells Newton that this body does not currently need to be simulated.
However, if the body is part of a larger configuration it may be affected indirectly by the reaction forces
of objects that it is connected to.
<p> <h4>See also</h4> <a HREF="#NewtonWorldUnfreezeBody">NewtonWorldUnfreezeBody</a>, <a HREF="#NewtonBodySetAutoFreeze">NewtonBodySetAutoFreeze</a>, <a HREF="#NewtonBodyGetAutoFreeze">NewtonBodyGetAutoFreeze</a>
</div>
</div>
<div class=Section>
<h3>
<a NAME="NewtonWorldUnfreezeBody"></a>
<a NAME="NewtonWorldUnfreezeBody"></a>
NewtonWorldUnfreezeBody
</h3>
<div class=Api>
void <font class=ApiName>NewtonWorldUnfreezeBody</font>(<br> const NewtonWorld* newtonWorld,<br> const NewtonBody* body)
</div>
<div class=SectionText>
Add the body to the active simulation list.
<p> <h4>Parameters</h4>
<p><table class=DefTable>
<tr class=Def>
<td class=Def>
<b>const NewtonWorld</b> *newtonWorld
</td>
<td class=DefSep>-</td>
<td class=DefText>
is the pointer to the Newton world
</td>
</tr>
<p>
<tr class=Def>
<td class=Def>
<b>const NewtonBody</b> *body
</td>
<td class=DefSep>-</td>
<td class=DefText>
is the pointer to the body to be activated
</td>
</tr>
</table>
<p>
<h4>Return</h4> Nothing
<p> <h4>Remarks</h4> This function tells Newton to simulate the rigid body <b>body</b>.
<p> <h4>See also</h4> <a HREF="#NewtonWorldFreezeBody">NewtonWorldFreezeBody</a>, <a HREF="#NewtonBodySetAutoFreeze">NewtonBodySetAutoFreeze</a>, <a HREF="#NewtonBodyGetAutoFreeze">NewtonBodyGetAutoFreeze</a>
</div>
</div>
<div class=Section>
<h3>
<a NAME="NewtonWorldForEachBodyDo"></a>
<a NAME="NewtonWorldForEachBodyDo"></a>
NewtonWorldForEachBodyDo
</h3>
<div class=Api>
void <font class=ApiName>NewtonWorldForEachBodyDo</font>(<br> const NewtonWorld* newtonWorld,<br> NewtonBodyIterator callback)
</div>
<div class=SectionText>
Iterate thought every body in the world calling the function callback.
<p> <h4>Parameters</h4>
<p><table class=DefTable>
<tr class=Def>
<td class=Def>
<b>const NewtonWorld</b> *newtonWorld
</td>
<td class=DefSep>-</td>
<td class=DefText>
is the pointer to the Newton world.
</td>
</tr>
<p>
<tr class=Def>
<td class=Def>
<b>NewtonBodyIterator</b> callback
</td>
<td class=DefSep>-</td>
<td class=DefText>
application define callback
</td>
</tr>
</table>
<p>
<h4>Return</h4> nothing
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -