Interaction between VehicleConstraint and mAllowSleeping #1443
-
I have a case where I'm attaching a // If the wheels are rotating, we don't want to go to sleep yet
bool allow_sleep = mController->AllowSleep();
if (allow_sleep)
for (const Wheel *w : mWheels)
if (abs(w->mAngularVelocity) > DegreesToRadians(10.0f))
{
allow_sleep = false;
break;
}
if (mBody->GetAllowSleeping() != allow_sleep)
mBody->SetAllowSleeping(allow_sleep);
// Increment step counter
++mCurrentStep; It makes sense to keep the body awake here, but is a (very slight) bummer to have to property overwritten. I'm curious if it has to work this way? I haven't looked that deeply yet, but would it be sufficient to just reset the sleep timer? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Good point. I think the answer to that question is that the |
Beta Was this translation helpful? Give feedback.
Good point. I think the answer to that question is that the
ResetSleepTimer
function didn't exist at the time I wrote that code. I've changed the code to use that function in #1444.