- Home /
Rolling sphere "foot" on ground?
I have a simple rolling sphere using physics and force to rotate and move around. However, I want to bend these physic rules for slopes... picture a giant tube and a marble inside of it.
The tube innards are the "ground" and the marble can go all the around, meaning gravity should not be pulling in (0,-1,0) but instead some sort relation to where the marble and tube are touching. What I decided to call the marbles "foot" - where the tube and marble collide.
I think if I can get that foot position/rotation I can somehow alter the gravity vector based on the rotation on every update.
On a side note, I already got the camera to correctly rotate/follow so that it appears the marble is always "on the ground" or level -- so know once you get about 45 degrees up the side of the tube you stop, the slowly fall backwards.
I know I can just increase the speed or lower mass/drag to make it realistically go up the sides and do a 360, but that's not the intent.
So basically, is there an easy way to attach a plane to a rolling sphere so that its position/rotation is where the sphere collides with the tube?
-Thanks
Answer by Charles-Van-Norman · Nov 05, 2010 at 01:54 AM
Can you make this question more clear? Is the plane supposed to move as the marble rolls in the tube, or can the plane be stationary while the tube rolls around it?
When I picture your gravity problem, I picture having global -y be "down" to the player, and the marble will always be at the "bottom" of the tube in this regard. Instead of letting the marble roll "up" the walls of the tube, just let the tube roll around the marble.
Answer by elbon96 · Dec 04, 2010 at 05:34 PM
What you could do is turn the gravity to zero and apply a downward force on the sphere. Would that work?
Your answer
![](https://koobas.hobune.stream/wayback/20220613071241im_/https://answers.unity.com/themes/thub/images/avi.jpg)