- Home /
Detect triggers with character controller
I'm currently modifying the standard third person controller (js) to do certain things that a later C# character controller will do, and I have an object with a C# script (all the script does is play sound when the player hits it) and a box trigger on it. Is there any function that lets the character controller detect when it hits a trigger?
$$anonymous$$aybe try adding a kinetic rigidbody to the character? Since triggers only register objects with rigidbodies on them.
Ive noticed strange behaviors sometimes when adding a rigidbody to a character controller. have the trigger tell the player when they hit it. Put a rigidbody on the trigger like eviltak mentions
Answer by EvilTak · Dec 06, 2014 at 12:48 PM
Don't put a rigidbody on the trigger, put it on the character. Sorry for any misunderstanding created, triggers only register objects which have rigidbodies. Although I have seen behaviour when triggers have recognized objects without rigidbodies, so give it a try without a rigidbody. Add a script to your trigger with an OnTriggerEnter function, and play your sound in that. If that doesn't work add a kinematic rigidbody to your character.