Sphere refusing to enter trigger area

[SOLVED]

Hi all! This is my very first foray into 3D and Unity, so my question is very basic.
I have my player object pushing a sphere (from now on referred to as a ball) around. Both of these objects have rigidbodies so that they can collide with things, though for now, the player char is kinematic to avoid messing up facing direction/key-press. I’ve also set up a simple box collider that, when the ball enters it, pops text up on the UI layer for a little while. So far so good.

However, the ball refuses to enter the trigger area. It brushes up against the collider area and triggers, sure, but it doesn’t move through it but acts like it’s hit a wall. I figure it’s because the box collider’s “is trigger” isn’t ticked*, but here’s the thing:* if I do tick “is trigger”… nothing happens. The ball goes straight through it and doesn’t trigger the script.

I’ve tried giving the box collider/trigger area a rigidbody, I’ve turned gravity on/off, I fiddled around with meshes. I moved the script around so that it’d destroy the object in collision just to double check that it’s not a badly written script, but that also only works when the trigger area doesn’t have “is trigger” ticked and functions like a hard wall… What am I doing wrong? Thanks so much in advance!

Do you use OnTriggerEnter2D instead of OnCollisionEnter2D?

Nope: it’s a 3D scene with 3D objects and I’m using OnCollisionEnter.

You’re using OnCollisionEnter on your trigger, not OnTriggerEnter? Sounds like you’re just not using OnTriggerEnter, which is what you need for triggers.

2 Likes

Do not ask why I though you were working with 2d. Still dgoyette is right - you should use OnTriggerEnter/OnTriggerStay/OnTriggerExit when you’re working with isTrigger clicked.

cc: @arahmitz

I-- Yeah, that’s exactly what the problem was. I’d been watching a bunch of vids about collisions and the importance of using oncollision instead of ontrigger and that late at night, brain just fried. Thanks a bunch!