- Home /
How did I screw up BoxColliders?
Hello, I'm having a problem with box colliders. I want the sword, which is tagged as weapon and has a box collider to trigger the player's box collider and script upon entering. The player's collider and script is looking for a weapon tag upon entering and printing a debug log saying working. I've followed brackey's tutorial for getting a door working and tried to reverse engineer that. Can anyone point me towards what I'm doing wrong? #pragma strict
function Update () {
}
function OnTriggerEnter (theCollider : Collider) { if (theCollider.tag == "Weapon") { Debug.Log("Working"); } } `
Answer by TrickyHandz · Oct 06, 2013 at 01:58 AM
You need to add a rigidbody to one or both of the objects for the trigger to detect the collision. You can check "IsKinematic" on the rigid body so that it will ignore gravity and physics collisions and only pay attention to the trigger events.
Thank you for your help, it works. Now to get back to work and learn some more!
Your answer
Follow this Question
Related Questions
Internal collisions 1 Answer
Tipping a cube over 2 Answers
Box collider on a default plane 0 Answers
How can I make diagonal collisions work with raycasts from a boxcollider? (3D, C#) 0 Answers
2D box colliders gap 0 Answers