Ball moving in tube with rigidbody - unity3d

Lets say you have a sphere(rigidbody, sphere collider) inside a tube(mesh collider). I want a ball to move in the direction of tube always by applying force on rigidbody.
My purpose is to simulate the circular gravity, so that ball can fall down back obviously in circular motion. This was the approch i was using to simulate fake circular gravity.
How can I check which direction of force has to be applied to continue motion following the path of the tube with addforce?

try applying physics material to your tube to control the ball reaction to the surface of the tube.

Related

Floor affects ball force direction

I'm creating a pool game. The ball has a trajectory direction and I move the ball using AddForce. My problem right now is if the ball is touching the floor it's direction will go a little offcourse while if it doesn't touch the floor the direction is pretty accurate. What can be the cause of this? Btw, I have set the angular drag and drag to 0 same as friction
Make sure the floor is using a box collider and not a mesh collider, in case maybe the mesh has some deformities. Check the same for the billiard balls that they are using sphere colliders. It also sounds like maybe the floor could be at a slight angle, so be sure to check the rotation of its GameObject as well as all its parents in the hierarchy.

How to determine when player (cylinder) has moved above a plane in unity 3D?

I am making a delivery game and temporarily designed my game so that the player who is a cylinder at the moment has to locate the delivery location which is a flat plane and move onto it in order to deliver the objects.
I have tried adding a 2d box collider to the plane to detect when the player collides with the plane but the collider only works on the x,y axis and i am not able to rotate it 90 degrees.
So my question is what is the best way to determine when the player has moved above the plane?
Here is a picture to demonstrate what i mean:
Before moving onto plane
How to i detect this:
Player is on top of plane
First, make sure at least one of the objects has a rigid-body component. If you are using a character controller to control your player, add the rigid body to the plane. If you don't want the rigid body to affect the plane, just freeze all the position and rotation constraints. Next, make sure both of the objects have a 3D collider, not 2D. Your game is 3D and needs 3D colliders. 2D is for 2D games such as sprites. (I recommend a cylinder collider for the player and a box collider for the plane.) Make sure the plane's collider "isTrigger" is enabled. This should work for you to detect the collision.

How to make that 2d collider dont slide on on an inclined plane

If 2d collider with rigidbody with freezed Z rotation touches an inclined plane with its lower edge, then it begins to slide down, how to get rid of this effect? I want if rigidbody edge touch the inclined plane, rigidbody should keep his own position and dont slide down.
I agree with BugFinder, a frozen rotation on a Rigidbody will not affect the interaction between the collider and the inclined plane. You should create a new PhysicsMaterial and assign it to your Collider that is assigned to your Rigidbody. Increase either its staticFriction, dynamicFriction, or both, as well as experimenting with the frictionCombine option, which will change how the friction value of your Rigidbody will interact with the collider of the inclined plane.

How to flip the normals of the collider mesh in Unity

I have a sphere in Unity and have used a script to flip the normals so I can see a 360 texture on the inside. I'm doing this because eventually I want to play a video on the inside, and also have other spheres inside hat can be thrown around and bounce off the inside walls of the outer sphere. The problem is, despite the normals of the sphere facing inwards, the collision is still standard. Objects within the sphere just fall straight through.
Do I need to add to my script to include the collision mesh?
you cannot have non-convex MeshColliders behave as Rigidbodies in Unity, you need to fake the walls as a series of convex colliders, approximate with box colliders maybe?

Unity Camera Bounces with Sphere Animation when trying to apply gravity with Rigidbody

I have an empty Object that has, among other things, a third and first person camera, and a sphere with a bouncing animation attached to it. I'm try to get it so that the sphere experiences gravity, but I'm having a lot of problems.
What I want is gravity on my sphere and the camera to not bounce with the ball.
Here a couple scenarios I've tried, and their outcomes:
1) When I attach a rigid body to the the Sphere (child of the empty Object) with apply root motion true or false, my character experiences no gravity. The ball bounces, but the camera follows the ball without bouncing with the ball. It also follows if i press the space button (to jump) The whole problem is i need gravity to fall back down when i jump. Right now i just go up.
2) When I attach a rigid body to the empty object (the parent), I gain gravity, but now my camera bounces with the ball, and if the ball tumbles and rotates, the camera rotates with it.
Is there a way to get the best of both worlds?
i.e: Ball experiences gravity, but the camera does not. The camera simply follows around the ball from first or third person view without bouncing.
Thanks so much
For me, I would like to create a Vector3D variable to record the offset between the ball and the camera. And you simply add the offset to your camera each time so your camera can chase the ball without bouncing with it.
For example:
Vector3D offset = cameraPos - ballPos;
//...
CameraPos = ballPos + offset;
If you don't want the camera moving with ball's gravity, you can block the change of Y axis.