Am planning to build a game which involves making a simple Ball as a main character and it will move inside a Tunnel. The player can Move forward, Left and Right. Also the player can basically go 360 degree inside the tunnel. So, it will not have a gravity system.
Collision Detection need to be High as the game move forwards the speed increases. The interested thing about this game is it will be fast and player can run through 360 degree in the tunnel.
I would highly appreciate for your valuable input and time. Thanks in advance.
Hey there, are you sure you actually need physics to do this? Often for this type of thing you would keep the ball in the same z position and move or create a tunnel around it.
I have set up a simplish script which you can see below, which will work given that you can find the correct ‘centre’ position, however if you are moving the ball, especially in a changing direction (a curved tunnel) finding the centre from which to apply gravity becomes more difficult. In that case you will have to code a slightly more complicated and more expensive (computationally) script where you find the normal of the collision between the ball and tunnel surface and apply gravity in the opposite direction of that. You can get the normals of the contact points from OnCollisionStay
Here is a more trivial approach for simplified cases!