Sphere with constant speed and bouncing attribute.

Hi

I would like to make sphere with constant speed and bouncing attribute in 2d game. I’ve 3D scene with camera from the top (like in the picture below). I can’t find out how to make sphere to bouncing from triangles or other figures, with only constant speed in many directions. Is there any way to solve this?

this code isnt complete. you would have to figure out the details yourself. i would get the rotation of the object that the ball collides with and add it to the ball on collistion.

var B :GameObject;
function Update(){
transform.Translate(Vector3.forward * Time.deltaTime);}

function OnCollisionEnter(bumped : Collision) {

b = bumped.collider.gameObject;

transform.rotation= b.transform.rotation;}

play with the the math to add or subtract or multiply between the two object’s angles to get the result you are looking for.