- Home /
On Trigger Enter (No Rigidbody)
Hi,
Here's the scenario I'm trying to solve. I have spheres with colliders that move on random paths I have established. There are boxes with triggers on them that spawn in random parts of the scene. If a sphere enters a trigger I want it to stop. The trick to this is that I don't want to put a rigidbody on the sphere or the box. I've tried this and while it does make the sphere stop, it also makes things start to slide around and become unpredicatble.
Basically I'm looking for a way to use functionality like "OnTriggerEnter" without the extra step of using rigidbodies.
Any suggestions?
This is the code I'm currently using:
function OnTriggerEnter (trigger:Collider) {
if(trigger.tag == "sphere") {
sphereSpeed = 0;
}
}
Answer by Lovrenc · Jan 20, 2013 at 02:45 AM
Look at the matrix at the bottom of the page. One object or the other just needs rigidbody... If you dont want hte physics to kick in on collisions and such just tick isKinematic.
That's so simple and does exactly what I was looking for.
Thank you!
Your answer
Follow this Question
Related Questions
Objects placed manually collide, but don't if instantiated? 1 Answer
OnTriggerEnter not being called, have trigger, RB, and colliders set? 1 Answer
Trigger via Collider 1 Answer
Can't click gameobject when over another trigger? 1 Answer
Do continuous and continuous dynamic collision detection work with trigger colliders? 1 Answer