I have four objects: Player (Box Collider with trigger disabled), Bullet (same as player), a ball (Sphere collider with trigger on), and a goal (Mesh Collider with trigger disabled).
I need the player to be able to trigger a ball pickup, and the ball to collide with the goal (say the player shoots the ball from an odd angle, and misses the hole), and I need the bullets to collide with the player and cause them to spin out.
I can get the bullets, players, and balls to interact properly. But, I can't seem to find the right combination to make the ball collide with the goal, and bounce off.
The strange thing is, I had all four of these objects working perfectly as they should, but somewhere along the path, I broke these things somehow.
If I turn the player into a trigger, then the ball into a non-trigger, then bullets go through the player without collision, yet the ball will bounce off the goals.
Any ideas would be appreciated.
I did not resolve this by messing with the triggers, however I opted to add a second Collider to the ball. The first Collider has the trigger turned off, and collides only with the goals, thanks to the physics matrix in the preferences. The second Collider, with a trigger, is a child GameObject of the ball, and triggers when players touch it.
Since the ball is a trigger, you should be able to add the code to the balls OnTriggerEnter function.
if(collider.tag == "goal") //etc...
If you wanted actual physics, you could turn trigger off during a shot, that should allow normal collision detection
another option is to add an empty child object to the ball, and make THAT the trigger
Finally, for the full picture, go to this link, and scroll down to the bottom:
the collision matrix there will answer your exact questions..