在PhysX3.2中,刚体模拟相对于2.8.x时代,多了两个概念:contactOffset和restOffset。这两个变量加入的初衷是为了让SDK能够更好的控制相互靠的很近的物体,尽快将他们稳定下来。我们来看看文档对这两个变量的描述:
/**
\brief Sets the contact offset.
Shapes whose distance is less than the sum of their contactOffset values will generate contacts. The contact offset must be positive and
greater than the rest offset. Having a contactOffset greater than than the restOffset allows the collision detection system to
predictively enforce the contact constraint even when the objects are slightly separated. This prevents jitter that would occur
if the constraint were enforced only when shapes were within the rest distance.
<b>Default:</b> 0.02f * PxTolerancesScale::length
<b>Sleeping:</b> Does <b>NOT</b> wake the associated actor up automatically.
\param[in] contactOffset <b>Range:</b> (maximum(0,restOffset),inf)
@see getContactOffset PxTolerancesScale setRestOffset
*/
virtual void

本文详细介绍了PhysX 3.2中刚体模拟的contactOffset和restOffset参数,解释了它们如何影响物体碰撞及稳定性。contactOffset使碰撞形体略微膨胀,提前感知碰撞,而restOffset定义了物体允许的嵌入深度。通过实验和代码示例,阐述了这两个参数如何帮助物体更快进入稳定状态,并提供了调整参数以适应不同场景的建议。
最低0.47元/天 解锁文章
2346

被折叠的 条评论
为什么被折叠?



