I’ve spent hours now trying to get this to work. I have a box collider with the Is Trigger selected, and a Player object with a RigidBody. When the player enters the trigger, it should say “Triggered” in the Console. It’s just not happening I’ve checked the Unity page for Colliders and made sure I have everything I need for the trigger to detect the player. Does anyone have any idea why it isnt working?
Are you using the OnTriggerEnter()? Have you checked your collision filters Edit->Project Settings->Physics and verify that the layers each object is on is colliding with one another.
Are the objects actually intersecting?
In the future provide some code so those on the forum can check it for problems.
Sorry, was about toedit the post with code and something came up. The code is:
`void onTriggerEnter(Collider other) {
Debug.Log("Triggered in");
if (other.gameObject.name=="Player")
{
player.updateGUI("Press e to push button");
player.triggerButton(true,this);
}
}
void onTriggerExit(Collider o) {
if (o.gameObject.name=="Player")
{
player.updateGUI("Press e to push button");
player.triggerButton(true,this);
Debug.Log("Triggered out");
}
}`
I’ve been to the Physics settings but I can’t see anything about layers? I’m on 2.6 if it helps. The objects are fully intersecting, and I have tried using small + bigger cubes, and lowering/raising them.
I read somewhere about changing the mesh to convex, but i don’t seem to have that option - is that possibly the problem? I’ve done triggers before, and they’ve worked, which is why I’m so confused now :S I’m going to start a completely new project and try again, in case I have messed some settings up in this one, but if you can help/explain what I did wrong, I’d really appreciate it!