📄 newton.htm
字号:
<p> <h4>Remarks</h4> The application can call this function to iterate thought every body in the world.
the application should provide the function <b>NewtonBodyIterator callback</b> to be called by Newton for every body in the world
<p> <h4>Remarks</h4> this function affect severally the performance of Newton. The application should call this function only for debugging purpose
See also: <a HREF="#NewtonBodyForEachPolygonDo">NewtonBodyForEachPolygonDo</a>
</div>
</div>
<div class=Section>
<h3>
<a NAME="NewtonGetVersion"></a>
<a NAME="NewtonGetVersion"></a>
NewtonGetVersion
</h3>
<div class=SectionText>
Return the current library version number.
<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>Return</h4> release decimal three digit value x.xx
the first digit: is mayor version number (interface changes among other things)
the second digit: is mayor patch number (new features, and bug fixes)
third digit: is minor bug fixed patch.
</div>
</div>
<div class=Section>
<h3>
<a NAME="NewtonWorldSetUserData"></a>
<a NAME="NewtonWorldSetUserData"></a>
NewtonWorldSetUserData
</h3>
<div class=Api>
void <font class=ApiName>NewtonWorldSetUserData</font>(<br> const NewtonWorld* newtonWorld,<br> void* userData)
</div>
<div class=SectionText>
Store a user defined data value with the 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>void</b> *userDataPtr
</td>
<td class=DefSep>-</td>
<td class=DefText>
pointer to the user defined user data value.
</td>
</tr>
</table>
<p>
<h4>Return</h4> Nothing.
<p> <h4>Remarks</h4> The application can store a user defined value with the Newton world. The user data is useful for application developing
object oriented classes based on the Newton API.
<p> <h4>See also</h4> <a HREF="#NewtonWorldGetUserData">NewtonWorldGetUserData</a>
</div>
</div>
<div class=Section>
<h3>
<a NAME="NewtonWorldGetUserData"></a>
<a NAME="NewtonWorldGetUserData"></a>
NewtonWorldGetUserData
</h3>
<div class=Api>
void* <font class=ApiName>NewtonWorldGetUserData</font>(const NewtonWorld* newtonWorld)
</div>
<div class=SectionText>
Retrieve a user previously stored user define value with the 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>
</table>
<p>
<h4>Return</h4> user data value.
<p> <h4>Remarks</h4> The application can store a user defined value with the Newton world. The user data is useful for application developing
object oriented classes based on the Newton API.
<p> <h4>See also</h4> NewtonWorldGetUserData
</div>
</div>
<div class=Section>
<h3>
<a NAME="NewtonWorldRayCast"></a>
<a NAME="NewtonWorldRayCast"></a>
NewtonWorldRayCast
</h3>
<div class=Api>
void <font class=ApiName>NewtonWorldRayCast</font>(<br> const NewtonWorld* newtonWorld,<br> const dFloat* p0,<br> const dFloat* p1,<br> NewtonWorldRayFilterCallback filter,<br> void* userData)
</div>
<div class=SectionText>
Shoot a ray from p0 to p1 and call the application callback with each ray intersection.
<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 world.
</td>
</tr>
<p>
<tr class=Def>
<td class=Def>
<b>const dFloat</b> *p0
</td>
<td class=DefSep>-</td>
<td class=DefText>
pointer to an array of at least three floats containing the beginning of the ray in global space.
</td>
</tr>
<p>
<tr class=Def>
<td class=Def>
<b>const dFloat</b> *p1
</td>
<td class=DefSep>-</td>
<td class=DefText>
pointer to an array of at least three floats containing the end of the ray in global space.
</td>
</tr>
<p>
<tr class=Def>
<td class=Def>
<b>NewtonWorldRayFilterCallback</b> filter
</td>
<td class=DefSep>-</td>
<td class=DefText>
user define function to be called for each body hit during the ray scan.
</td>
</tr>
<p>
<tr class=Def>
<td class=Def>
<b>void</b> *userData
</td>
<td class=DefSep>-</td>
<td class=DefText>
user data to be passed to the filter callback.
</td>
</tr>
</table>
<p>
<h4>Return</h4> nothing
<p> <h4>Remarks</h4> The ray cast function will call the application with each body intersecting the line segment.
By writing the callback filter function in different ways the application can implement different flavors of ray casting.
For example an all body ray cast can be easily implemented by having the filter function always returning 1.0, and copying each
rigid body into an array of pointers; a closest hit ray cast can be implemented by saving the body with the smaller intersection
parameter and returning the parameter t; and a report the first body hit can be implemented by having the filter function returning
zero after the first call and saving the pointer to the rigid body.
<p> <h4>Remarks</h4> The most common use for the ray cast function is the closest body hit, In this case it is important, for performance reasons,
that the filter function returns the intersection parameter. If the filter function returns a value of zero the ray cast will terminate
immediately.
<p> <h4>Remarks</h4> The ray cast function is provided as an utility function, this means that even thought the function is very high performance
by function standards, it can not by batched and therefore it can not be an incremental function. For example the cost of calling 1000
ray cast is 1000 times the cost of calling one ray cast. This is much different than the collision system where the cost of calculating
collision for 1000 pairs in much, much less that the 1000 times the cost of one pair. Therefore this function must be used with care,
as excessive use of it can degrade performance.
</div>
</div>
<div class=Section>
<h3>
<a NAME="GroupID^interface"></a>
<a NAME="GroupID interface"></a>
GroupID interface
</h3>
<div class=SectionText>
<p>
</div>
</div>
<div class=Section>
<h3>
<a NAME="NewtonMaterialGetDefaultGroupID"></a>
<a NAME="NewtonMaterialGetDefaultGroupID"></a>
NewtonMaterialGetDefaultGroupID
</h3>
<div class=Api>
int <font class=ApiName>NewtonMaterialGetDefaultGroupID</font>(const NewtonWorld* newtonWorld)
</div>
<div class=SectionText>
Get the value of the default MaterialGroupID.
<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>Return</h4> The ID number for the default Group ID.
<p> <h4>Remarks</h4> Group IDs can be interpreted as the nodes of a dense graph. The edges of the graph are the physics materials.
When the Newton world is created, the default Group ID is created by the engine.
When bodies are created the application assigns a group ID to the body.
</div>
</div>
<div class=Section>
<h3>
<a NAME="NewtonMaterialCreateGroupID"></a>
<a NAME="NewtonMaterialCreateGroupID"></a>
NewtonMaterialCreateGroupID
</h3>
<div class=Api>
int <font class=ApiName>NewtonMaterialCreateGroupID</font>(const NewtonWorld* newtonWorld)
</div>
<div class=SectionText>
Create a new MaterialGroupID.
<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>Return</h4> The ID of a new GroupID.
<p> <h4>Remarks</h4> Group IDs can be interpreted as the nodes of a dense graph. The edges of the graph are the physics materials.
When the Newton world is created, the default Group ID is created by the engine.
When bodies are created the application assigns a group ID to the body.
<p> <h4>Note</h4> The only way to destroy a Group ID after its creation is by destroying all the bodies and calling the function *NewtonMaterialDestroyAllGroupID*.
<p> <h4>See also</h4> <a HREF="#NewtonMaterialDestroyAllGroupID">NewtonMaterialDestroyAllGroupID</a>
</div>
</div>
<div class=Section>
<h3>
<a NAME="NewtonMaterialDestroyAllGroupID"></a>
<a NAME="NewtonMaterialDestroyAllGroupID"></a>
NewtonMaterialDestroyAllGroupID
</h3>
<div class=Api>
void <font class=ApiName>NewtonMaterialDestroyAllGroupID</font>(const NewtonWorld* newtonWorld)
</div>
<div class=SectionText>
Remove all groups ID 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 the pointer to the Newton world
</td>
</tr>
</table>
<p>
<h4>Return</h4> Nothing.
<p> <h4>Remarks</h4> This function removes all groups ID from the Newton world.
This function must be called after there are no more rigid bodies in the word.
<p> <h4>See also</h4> <a HREF="#NewtonDestroyAllBodies">NewtonDestroyAllBodies</a>
</div>
</div>
<div class=Section>
<h3>
<a NAME="Material^setup^interface"></a>
<a NAME="Material setup interface"></a>
Material setup interface
</h3>
<div class=SectionText>
<p>
</div>
</div>
<div class=Section>
<h3>
<a NAME="NewtonMaterialSetDefaultCollidable"></a>
<a NAME="NewtonMaterialSetDefaultCollidable"></a>
NewtonMaterialSetDefaultCollidable
</h3>
<div class=Api>
void <font class=ApiName>NewtonMaterialSetDefaultCollidable</font>(<br> const NewtonWorld* newtonWorld,<br> int id0,<br> int id1,<br> int state)
</div>
<div class=SectionText>
Set the material defined by the interaction between two physics groups to be collidable or non-collidable by default.
<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>int</b> id0
</td>
<td class=DefSep>-</td>
<td class=DefText>
group id0
</td>
</tr>
<p>
<tr class=Def>
<td class=Def>
<b>int</b> id1
</td>
<td class=DefSep>-</td>
<td class=DefText>
group id1
</td>
</tr>
<p>
<tr class=Def>
<td class=Def>
<b>int</b> state
</td>
<td class=DefSep>-</td>
<td class=DefText>
state for this material: 1 = collidable; 0 = non collidable
</td>
</tr>
</table>
<p>
<h4>Return</h4> Nothing.
</div>
</div>
<div class=Section>
<h3>
<a NAME="NewtonMaterialSetContinuousCollisionMode"></a>
<a NAME="NewtonMaterialSetContinuousCollisionMode"></a>
NewtonMaterialSetContinuousCollisionMode
</h3>
<div class=Api>
void <font class=ApiName>NewtonMaterialSetContinuousCollisionMode</font>(<br> const NewtonWorld* newtonWorld,<br> int id0,<br> int id1,<br> int state)
</div>
<div class=SectionText>
Set the material defined by the interaction between two physics groups to enable or desable continue collision.
<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>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -