- Home /
Enemy can't trigger a hit when the player doesn't move
The Situation: There is a trigger collider on a weapon model which is enabled during certain parts of an animation. Attached also is a kinematic rigidbody. For gameplay purposes, it's the knife for a melee enemy and damages the player when it hits them.
The player has a Character Controller collider with a kinematic rigidbody.
The problem: The knife's OnTriggerEnter does not work when the player is standing still. When I mash the movement keys or even simply wiggle the mouse around while the enemy does an attack, OnTriggerEnter for the melee weapon calls without an issue, but when I stand still, the knife does pass through me but doesn't call OnTriggerEnter at all.
Here is a picture I got when slowing down the timescale to see if it was too fast to detect the collision, but it DOES go through the player, showing that it should collide. For reference of what you're looking at, that's a top-down look of the player and his arms with an enemy attacking him with a knife. The knife is in the middle of the character collider.
The Question: How on earth do I get this to work? Apparently the issue is that the player's rigidbody is sleeping when it isn't moving, but because both objects have a kinematic rigidbody with a trigger collider, shouldn't this just work?
The collision matrix here says that a Kinematic Rigidbody Trigger Collider should work on anything, so why doesn't it? What should I try and do?
Your answer
![](https://koobas.hobune.stream/wayback/20220612160752im_/https://answers.unity.com/themes/thub/images/avi.jpg)