i have a wall.When i enable gravity then the throwing ball bounced to the wall and come back but in this case it doesn’t execute OnTriggerEnter. when i checked both gravity and trigger the ball passes through the wall.my code is nothing special.that’s why i didn’t it write it here.please help me solving this problem
[minor edit] If you want it to bounce off the wall, you can have that “trigger” a sound, but have to name it OnCollisionEnter
instead of OnTriggerEnter
. See the reference manual for the magic words you need (Search for Unity OnCollisionEnter. The example even plays a sound.)
For example, suppose you have an OnCollision and an OnTrigger in the same script. Unity will run one on a hit, depending whether isTrigger is checked. The other one is always sort of in reserve, in case isTrigger gets flipped.