This project has moved. For the latest updates, please go here.


Topics: User Forum
Nov 9, 2008 at 2:53 AM
Edited Nov 9, 2008 at 2:54 AM
Can someone explain to me how to use the InactivityController? I'm just playing around with the engine right now by spawning a bunch of circles, but none of them come to rest.
I use [PhysicsSimulator].InactivityController.Enabled = true; but it doesn't seem to be doing anything. All the objects moving at once brings my 360 to a crawl. Thanks.
Nov 9, 2008 at 3:15 PM
There is a little more to it that just activating the inactivity controller. You need to set some properties too.
The AdvancedSamples pack has an example on how to use the inactivity controller. Take a look at it and make sure to tweak the properties for your game.
Nov 14, 2008 at 10:09 AM
Hi AndrewNeo,

i developed the inactivitycontroller and hope i can clarify some things :)

Take a look at demo 3 of the advanced samples. You'll need to adjust the InactivityController.
In Demo3Screen.cs:

            // This distance has to be big enough to make sure all objects are reactivated
            // before they could collide with an currently active object
            // our biggest object is 25*25 -> 120 would be big enough
            PhysicsSimulator.InactivityController.ActivationDistance = 120;

            // Deactivate the object after 2 seconds of idle time
            PhysicsSimulator.InactivityController.MaxIdleTime = 2000;
            PhysicsSimulator.InactivityController.Enabled = true;

I think the comments are self-explanatory.

To let the controller be applied to a body, the properties "IsAutoIdle" and "MinimumVelocity" have to be set.
From Box.cs:

            _body.IsAutoIdle = true;
            _body.MinimumVelocity = 25;

This means that if this body is below a velocity of 25 for 2 seconds, it will be deactivated. The current amount of idle time of a body can be read from the property "IdleTime".

Nov 15, 2008 at 9:32 AM
Thanks for your responses! I've gotten it to work, for the most part.