This is gonna be quite beefy so I’ll put it into sections.
GOAL: I’m trying to set up a simple (weapon collides with enemy > enemy takes damage) script.
PROBLEM: After trying to debug my code and reading tons of things over the years about colliders, triggers, and rigidbodies, I’m starting to get confused about what is what.
Like which of the two objects need a Rigidbody based on whether I’m using “OnTriggerEnter” or “OnCollisionEnter”, as well as which of the two objects are supposed to be triggers. Also things like; Does “OnTriggerEnter” detect whether something enters this object’s trigger, or whether the trigger of this object enters something else, and same with “OnCollisionEnter”.
SETUP: The script is on the enemy object, and it’s looking for an object with the “Weapon” tag colliding with it. The enemy has to have a non-trigger collider and a kinematic rigidbody, because I don’t want the player to be able to pass through the enemy and also not be able to move them around. The sword object also has to have a trigger collider because I don’t want it physically colliding with neither the enemy nor the player.
What would be the correct method to use, OnCollision or OnTrigger? And would the sword also need a rigidbody?