I currently have a ball in my scene with a physic material to make it bounce. The bounciness is set to 1 and bounce combine is set to maximum. Currently it works and the ball bounces off all surfaces. How can make the ball not bounce off of an object? For example. If it hits a regular object it should bounce off. If it hits a specific object, I want it to not bounce off of it. How can this be done?,Hi, I currently have a ball in my unity scene with a physic material. The bounciness of the material is set to 1 and the bounce combine set to 1 so that the ball bounces off of surfaces. However I have some walls in my scene that I dont want to the ball to bounce off of. How can I the ball bounce off only the one surface that I choose?
To make the ball only bounce off some surfaces, you can use layer-based collision detection in Unity. You can assign each object in your scene to a specific layer, and then specify which layers should collide with each other in the project’s Physics Manager.
Here’s how you can do this:
In the Unity editor, select the ball game object and open the Inspector window. In the Inspector window, click on the tag dropdown menu and select “Add Tag…”.
In the “Tag Manager” window that appears, click on the “+” button to add a new tag. Name the tag “Bouncy” or something similar.
Next, select the game object that you don’t want the ball to bounce off of and open the Inspector window. In the Inspector window, click on the tag dropdown menu and select “Add Tag…”.
In the “Tag Manager” window that appears, click on the “+” button to add a new tag. Name the tag “NoBounce” or something similar.
In the Unity editor, go to Edit > Project Settings > Physics to open the Physics Manager. In the Physics Manager, you will see a section called “Layers”.
In the “Layers” section, scroll down to the bottom and find the “Bouncy” layer that you created earlier. In the “Collision Matrix” section, uncheck the box next to the “NoBounce” layer. This will prevent the ball from bouncing off of objects that are on the “NoBounce” layer.
Save your changes and try running the game again. The ball should now only bounce off of objects that are not on the “NoBounce” layer.
I hope this helps! Let me know if you have any other questions.