mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 09:24:00 +02:00
Add comments to updateCCDConfiguration
This commit is contained in:
parent
b75e053e9d
commit
b410604475
1 changed files with 9 additions and 1 deletions
|
@ -118,10 +118,18 @@ void ObjectMotionState::setMotionType(MotionType motionType) {
|
|||
void ObjectMotionState::updateCCDConfiguration() {
|
||||
if (_body) {
|
||||
if (_shape) {
|
||||
// If this object moves faster than its bounding radius * RADIUS_MOTION_THRESHOLD_MULTIPLIER,
|
||||
// CCD will be enabled for this object.
|
||||
const auto RADIUS_MOTION_THRESHOLD_MULTIPLIER = 2.0f;
|
||||
|
||||
btVector3 center;
|
||||
btScalar radius;
|
||||
_shape->getBoundingSphere(center, radius);
|
||||
_body->setCcdMotionThreshold(radius * 2.0f);
|
||||
_body->setCcdMotionThreshold(radius * RADIUS_MOTION_THRESHOLD_MULTIPLIER);
|
||||
|
||||
// TODO: Ideally the swept sphere radius would be contained by the object. Using the bounding sphere
|
||||
// radius works well for spherical objects, but may cause issues with other shapes. For arbitrary
|
||||
// objects we may want to consider a different approach, such as grouping rigid bodies together.
|
||||
_body->setCcdSweptSphereRadius(radius);
|
||||
} else {
|
||||
// Disable CCD
|
||||
|
|
Loading…
Reference in a new issue