Slow sphereControllers don't move on terrain if alone?

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
Akonyl
Posts: 4
Joined: Fri Sep 19, 2014 12:27 am

Slow sphereControllers don't move on terrain if alone?

Post by Akonyl »

Hi, I was wondering if this sounded familiar, or if it's a sign of something deeper I'd have to continue investigating on my side:

Basically, I have a terrain (flat in the tests being ran), and I have two sphere controllers, the player and an enemy. The enemy is a slow-moving zombie, however I noticed that it was only able to move while attacking or when near the player, and otherwise it was stuck in place (unless its speed was turned up to match the player's, both are .25f radius spheres, zombie with Speed=.1f, Player=1.5f). I eventually tracked this down to zones that I had spawned, when the enemy attacked it was creating a zone around it, and the player had a zone around them at all times for item interaction detection. These zones are entities which are part of a collision group which has NoSolver against the collisionGroup that contains the sphere controllers (as they need to detect objects, but not actually interact with them).

So when the enemy is interacting with one of these zones, it's able to shamble around again, rather than being locked in place. I confirmed that this isn't related to the rest of the attack/proximity logic, by placing an interaction zone around the enemy (which it has no way of using) and confirming that it could move again, despite the other logic being disabled.

My only assumption currently is that despite having NoSolver against these zones, the fact that the enemy is touching the zone is overwriting some sort of friction calculation that is otherwise being done on the terrain?

So basically, I have two questions:
1) What could be freezing my slow enemy in place? I've tried increasing the traction of the controller, and setting the material static/kinetic friction of the terrain and controllers to 0s, but none seem to have had much or any effect on the sphereControllers (even with 0 friction, the player was able to move fine, and the enemy was frozen). I also tried setting the traction on the sphereControllers, but that just resulted in my player being able to run through obstacles.
2) Is there a way to have whatever data is being overridden by the zones not be overridden? All I need from these zones are collision announcements, and would rather not have them having interactions with objects like this.

My solution for now is to just put a dummy zone around the enemy to let it move, but that seems pretty hack-y.
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Slow sphereControllers don't move on terrain if alone?

Post by Norbo »

It sounds like the zombies are going inactive. 0.1 falls below the Space.DeactivationManager.VelocityLowerLimit of 0.26, so unless they're interacting with an active object, are being actively modified, or increasing in energy, they'll go to sleep.

To address it, you could do one of the following:
-Set the Space.DeactivationManager.VelocityLowerLimit to something below the move speed.
-Set the character.Body.ActivityInformation.IsAlwaysActive = true for the zombies.
-Directly wake up the zombies, either explicitly or by doing things that cause it to wake up. For example, setting the character.HorizontalMotionConstraint.MovementDirection to a value different than its previous value will force the entity to wake up.
Akonyl
Posts: 4
Joined: Fri Sep 19, 2014 12:27 am

Re: Slow sphereControllers don't move on terrain if alone?

Post by Akonyl »

Yep, that did the trick, thanks! I didn't even know that property existed, but thinking about it, it makes total sense for activity to be tracked like that. I guess that also explains why they seemed to inch forward slightly before stopping, if changing the movement direction changes the state temporarily (as they toggle between 0,0 and 0,1), so cool beans.
Post Reply