void OnTriggerEnter(Collider current)
print(“here”); // never gets here.
if (current.tag == “Projectile”)
obj.health -= 10;
I want to check when a projectile that is a trigger hits a mesh that is also a trigger. The code above does nothing. It never actually gets inside the OnTriggerEnter.
One of them should have a kinematic rigidbody attached, you can check the isKinematic checkbox on the rigidbody to make it kinematic. so
do these steps
- Attach a Rigidbody component to your projectile prefab.
- check the isKinematic checkbox on the rigidbody
- run the game now
Kinematic rigidbodies don’t act like normal ones so you can move the gameObject like before and it’s still a normal triger and can not be moved by forces.
take a look at link textphysics manual pages for more information about the collision matrix and messages being sent between different colliders and kinematic rigidbodies.