Sphere moving after it goes inactive.

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
RyanGadz
Posts: 32
Joined: Thu Aug 12, 2010 8:34 pm
Contact:

Sphere moving after it goes inactive.

Post by RyanGadz »

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?

Code: Select all

                Space = new Space
                {
                    DeactivationManager =
                    {
                        VelocityLowerLimit = .4f,
                        LowVelocityTimeMinimum = .00001f
                    },
                };

Code: Select all

 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);

                }
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Sphere moving after it goes inactive.

Post by Norbo »

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.
RyanGadz
Posts: 32
Joined: Thu Aug 12, 2010 8:34 pm
Contact:

Re: Sphere moving after it goes inactive.

Post by RyanGadz »

Norbo wrote:Increasing the linear/angular damping a bunch over time will also make impulses fairly ineffective.
lol oh yeah I guess I never really reset the damping.. both are now set to zero right after the impulse and it seems to be working

thanks!
Post Reply