Sphere through wall - Mini-Golf

I am doing a mini-golf game and when the speed is too high my wall keep going through walls. I tried the (dontgothroughwall) code but it does not work. I tried with the raycast: saying to my ball if you collide with a wall get the normal with the "reflect" and go this way but it still not working out on high speed.

Anyone has a solution to this? I still want to have a realistic physic for the game (bouncyness etc) though.

thanks

Unity 3 potentially provides a solution in the form of Rigidbody.collisionDetectionMode. Have you tried it?

There are a couple things that you can do that will help.

1: Increase the Physics Timestep (in Time settings)

2: Make the walls thicker (atleast the collider)

3: Make sure the scene is the correct size, or make it bigger then normal.

You might also want to set the wall collider to Smooth and Convex collisions, sometimes it makes it work, sometimes it doesn't, tamper with the settings a little on the collider.

1: Increase the Physics Timestep (in Time settings) .... it worked great since i don't have untiy 3.

I do have Unity3... I'm so glad I read this because I'm having the same problem. I fixed it by upping the Fixed Time Step (in settings) from 0.02 to 0.01. I did not see any performance drop, although I am running a very simple game, and it fixed the problem entirely. Good luck :)