Hello.
I have a sphere with rigidbody attached to it in a cylindrel tunnel.
Basically I want to rotate this sphere around center point of Tunnel space.
This sphere has Gravity also. So that rotation looks realistic.
How can I achieve this?
I have tried rigidbody.AddTorque But it rotates sphere around its center point.
CenTerOfMass of sphere is located at Blue point in image So that sphere can rotate at walls of tunnel.
The Image below gives clear Idea.
Thnx in advance.

An untested idea: Use Vector3.Cross() to calculate the cross product between the axis of the tunnel and a ray from the axis sphere to the axis. This will give you a side vector to the sphere you can use in a Rigidbody.AddForce().
– robertbuhey. Thnx for your Idea.But what actually needs to be done I can't figure out from your answer.what does this 'ray from the axis sphere to the axis' means?
– mohammadkhatriI've tried it But it gives some wiered behaviour to rigidbody. It throws the Ball out of the Tunnel.
– mohammadkhatriAre you trying to get the ball to roll around the inside of a pipe? Also, you might want to go ahead and activate windows.
– electricsauceHey..robertu.! Your code works like a charm when my sphere is not moving forward but when it moves forward it seems to doesnt work .. my code is below.. CenterOfMass of sphere is at default point now. Vector3 v = Vector3.Cross(new Vector3(0,0,10),transform.position); v.Normalize(); //Debug.Log(v); Debug.DrawRay(transform.position,v); rigidbody.AddForce(v); sphere moving code is as below. rigidbody.velocity = (Vector3.forward * Time.deltaTime * speed);
– mohammadkhatri