Inactivity Controller issue

May 14, 2009 at 3:29 AM

I am using the inactivity controller on game characters. The problem is right now I am trying to figure out how to make them active again when the player is near, otherwise (even with 1 as min velocity) they seem to build up forces (trying to move towards player) while inactive, eventually being active and flying across the screen at a massive velocity.

Is there any direct way to make them active again?


May 14, 2009 at 11:31 AM

Is this in the 2.0.1 version or source control?

I'll take a look at it.

May 15, 2009 at 8:50 PM

I'll try the source control version (although it will be difficult since my game uses a modified farseer physics 2.0) to see if that helps

But just as a quick fix, is there anyway to make them active again? Setting min velocity to -1 or 0 doesn't seem to help

May 15, 2009 at 9:01 PM

Are you changing the velocity manually? The inactivitycontroller checks if a body is moving. The default minimumvelocity is 55. If a body has been idle for some time (does not move for one second) it gets disabled.

If a body comes closer than the default 100 length, it will activate the bodies around it. There should be no buildup of velocity, not from what I can see. Are you able to send me a sample that demonstrates this?

I asked if you used the source control version because I decoupled the InactivityController in upcoming 2.1. I might have introduced some bugs when I did it.

May 16, 2009 at 12:32 AM

I am just adding foces to it, not changing the velocity manually. Shouldn't adding any forces to an object automaticly make it active again?

It doesn't seem to, and just seems to build up force to a certain point

May 16, 2009 at 12:51 AM

What do you mean by a certain point?

And yes, adding forces to a body should wake it up again, but as it currently is, the inactivitycontroller works on a high level and it is not possible to wake up bodies on the fly - That would require a large change in structure and incorporation of the inactivity controller into the engine itself. This is also the plan and will be implemented in the future. I will take a look at it after 2.1 has been released.

A solution to wake up bodies until then would be to change the body's idletime to 0. (Body.IdleTime = 0)

May 16, 2009 at 1:51 AM

no real certain point, sometimes there is a giant build up (sending enemies flying across the screen) and other times it isnt noticable

That solution doesnt seem to wake them up either, they still only respond when the player is close enough

thanks for the help with this btw

May 16, 2009 at 2:49 AM
Edited May 16, 2009 at 2:50 AM

I had a similar problem in first project. If your code is anything like what I had, the forces applyed to your inactive enemies will build up, and as soon as they become active again all the built up force will act on them all at once. Try adding a check in your enemy logic (and/or any other part of your code that applies forces to the enemies) so that any force or impulse is not applyed when the enemy is inactive.

May 16, 2009 at 11:20 AM

@Vermeulen: Forgot to mention that you need to enable the body again after you reset idletime.

@vulgivagus: This kind of check will be in the engine when the reworked inactivity controller comes out. Until then, your solution is the way to go.