Pushing NPCs around

ChristianWiele

Active member
Hi,

in my multiplayer game the NPCs are also based on UCC. We now observed that client players are able to push the NPCs around by jumping at them. This does not happen when the master player jumps at the NPCs. Any idea what could go wrong here? The players shouldn't be able to physically interact with the NPCs at all.

Thanks, Christian
 
I suspect that when the client is interpolating between positions the colliders overlap and cause the character controller to depenetrate the colliders. At this point I'm not sure how you'd fix this unless you developed a smarter interpolation method but I can continue to think about it.
 
Can you point me to where the character controller does the de-penetration? Then I can check whether this is the case. My kids like pushing the NPCs around, but it is breaking the game in some cases.
 
This is done within CharacterLocomotion.DetectHorizontalCollisions/DetectVerticalCollisions.
 
Found the issue, and it is really related to the overlap. If the client player runs agains the NPC, sometimes the NPC CharacterLocomotion on the master detects an overlap with the client player's capsule collider. As the reaction, the NPC's CharacterLocomotion moves the NPC out of the way. I was able to solve the problem by putting players and NPC on different layers and set the character layer to be invisible to the NPC. This way the collision is only checked on the player which then can move out of the way.
 
Top