I'm making a golf game and I have the user putt the ball after the sphere/ball goes inactive. Problem is that the ball sometimes keeps moving after it goes inactive and I'm not sure how or why. Once it does this the user can no long apply an impulse to get it to move again. Any advice on what I should do?
if (ballSphere.ActivityInformation.IsActive)
{
// ball will be forced to slow down within a certain time after putting
timer2 += (float)gameTime.ElapsedGameTime.TotalSeconds;
ballSphere.AngularDamping = .16f * (timer2 - timer);
ballSphere.LinearDamping = .16f * (timer2 - timer);
}
An object which is truly inactive does not receive position updates, so it cannot change positions. An inactive object can have a nonzero velocity, however; it's just not used to move the entity. (Keeping the velocity around makes the sleep-wake transition more robust.) If it's actually moving around, something is interfering (other impulses, state setting, kinematic-dynamic state switching, etc.).
Increasing the linear/angular damping a bunch over time will also make impulses fairly ineffective.