- Home /
Trigger OnTriggerEnter Not Triggering Properly on Collision
So I have an Enemy object, and a Player object. The Enemy object is set to be a Trigger, while the Player object has a rigidbody (kinematic) and is not a trigger. Both objects have colliders. The idea is that on collision between these two objects, there should be 10 hp subtracted from the Player.
This works, mostly. The thing I've noticed is this: since my OnTriggerEnter code is on the Enemy object, while I can subtract the HP just fine, the function doesn't seem to be called if my Player is not moving, and the Enemy collides with it. OnTriggerEnter only seems to be called if my player is moving when they collide.
What's causing this, and how can I remedy it? I know i could simply put the OnTriggerEnter code on my Player object, but since I plan on having several different kinds of objects which subtract or add various things to the Player (HP, MP, etc), it's something much better left to each individual object. (Right?)