Sliding slope or ramp

I have a problem with send a character (ball in this picture). I want it to slide along a way that player created via dragging mouse like in the picture. i give a ball with rigidbody and add force to it when instantiate.

http://img.photobucket.com/albums/v204/pigman8857/Sliding.jpg

the problem is when the ball collide with the ramp that we created, it has bouncing, not go along the way smoothly and it didn’t go high like in the picture but fall down. How do i do??

Set the Physics.gravity to point down to the ground: if in your game the ground is at the XY plane, use Physics.gravity = Vector3(0, 0, 9.8);, for instance. In order to reduce the bouncing, try different physic materials for the ball and for the ground/walls, or just adjust their characteristics:

  collider.material.bounciness = 0; // zero the bounciness

Adjust also the force - too high, the ball may bounce excessively; too low, it may stop prematurely.

But remember: the physics engine try to reproduce a real physics system, so the ball will not do what you want, but just what it would do in the real world. In your drawing, for instance, the ball would follow the first wall as expected, but would bounce at the second wall and go to the left, returning to the first wall.

EDITED: I presumed that your game was 2D, the ball should run over a flat surface (the ground), and those blue pieces were walls - something like a pinball machine. In this case, the gravity should be perpendicular to your drawing.

But if the picture shows the vertical plane, then the gravity should point down (to this comment, for instance). You should not change gravity at each point, since it would affect every rigidbody in scene.

Supposing the drawing shows the XY plane, you don’t need to change Physics.gravity; just set the bounciness of the ball and the blue pieces to zero, and set the ball rigidbody velocity directly instead of applying a force:

  rigidbody.velocity = Vector3(50, 0, 0);

This will make the ball start running at 50 units/s to the right, like in your drawing. Controlling the velocity directly is easier than setting a force, since you don’t have to worry about mass and duration of the applied force. Try some different velocity values until you find the best one.

NOTE: Don’t set the velocity at each update! Set it only once, at the ramp start, and let physics do the rest.