Some NPCs able to be pushed around, others not

Imp079

New member
I've recently upgraded our NPC character controller to the UCC from an older version of TPC. We have nearly all of the issues ironed out but for some reason, one of our NPCs is able to be pushed around by the player, but others are not. Is there some setting somewhere that I might be overlooking?

We do want to be able to push the enemy NPCs away so that they can't corner the player. I was under the impression though that I would have to write some code to apply a pushing force to the NPCs to achieve this.

Our upgrade process involved reconfiguring one NPC's prefab with the new UCC components by hand until it was working (this happens to be the NPC that can be pushed around). Then I wrote an editor script to automatically duplicate the changes on the remaining NPCs. There's probably some discrepancy but I can't figure out what it is.

The player uses a non-kinematic rigidbody character controller that I wrote. It uses a hover method similar to the one in this tutorial video.

The pushable NPC's UCC mass is 20, and for comparison, two other enemies with masses of 10 and 70 cannot be pushed at all. The player's rigidbody mass is 70.

The NPCs and the player use vertically aligned capsule colliders that are all roughly 2 units high (the player's collider stops short of the ground though due to the hover method being used.)

Any help would be greatly appreciated. Also, let me know if there's any other information I could provide to help figure out what's going on.
 
Did you upgrade from version 1 of TPC? In general the character shouldn't be able to be pushed unless there is another collider that is contained within the character's collider. I would start basic and try a new character to see if that works, and then build up from there.
 
Did you upgrade from version 1 of TPC? In general the character shouldn't be able to be pushed unless there is another collider that is contained within the character's collider. I would start basic and try a new character to see if that works, and then build up from there.
Yes, version 1.3.6 I think. Definitely a lot of changes since that version. It's been an interesting learning curve.

Our NPCs do have several colliders - there's the capsule collider on the root that the character controller should use, but also another collider attached to the model that's used as a hitbox, as well as some melee colliders. We were actually using that hitbox collider to collide with the player since it matches up a little better with the shape and position of the NPC, but that seems problematic so I switched it to a trigger and adjusted the collision matrix in project settings.

The problem persisted even after that collider was made into a trigger, but went away when I updated the Collider Layer Mask on the UltimateCharacterLocomotion component to contain only the layer that the root collider is on. I assume that's the correct usage of that layer mask? Anyway, it seemed to work, so thank you very much for pointing me in the right direction!

I'm still a little unclear on what exactly the four layer masks are used for (Collider Layer Mask on the UCL, and Enemy Layers, Invisible Layers, and Solid Object Layers on the Character Layer Manager).

My understanding is:

Collider Layer Mask: The layers that the character's colliders are on
Enemy Layers: Layers that enemies are on, used to effect the crosshair
Invisible Layers: Layers that won't effect third person camera positioning
Solid Object Layers: Layers that the characters can collide with, including the ground, player, moving platforms, and NPCs

Is that about right, or am I missing something?
 
Collider Layer Mask: The layers that the character's colliders are on
Enemy Layers: Layers that enemies are on, used to effect the crosshair
Invisible Layers: Layers that won't effect third person camera positioning
Solid Object Layers: Layers that the characters can collide with, including the ground, player, moving platforms, and NPCs
Glad you got it working! Yes, those are correct
 
Top