basic physics elaciticity in colliders

Hi,

My current project is simple billiard project. I have added the sphere collider and rigidbody to all balls. using this I add force to the cuball it collides with balls and they give the real look but not perfect. any thing that i can do best to give reall physics.

secondly, I have to create elasticity in colliders of borders. I have used box colliders for the borders. balls simply collide with them and then stops. I am using the following code to return it to its normal. but its not working.

function OnCollisionEnter(collision : Collision)
{
if(collision.transform.name == "Border")
{
     for (var contact : ContactPoint in collision.contacts) 
     {
        rigidbody.AddRelativeForce(contact.normal);
     }
}
}

Any best suggestion or any resource available for this kind of project.

thanks

unitylearner

You should have a look at PhysicMaterial. You may set it in Colliders. There is bouncyness and the like that may be interesting for you.
Have a look at the documentation.

Sorry for late reply.

Bouncy material was really helpfull for borders and Metal for Balls were very usefull.

thanks for reply

Hi,

One thing more the attached image shows the settings for the Metal material. But the physics don’t seem to be perfect, as I am using the balls as metal. what settings can make them perfect balls (I am not sure of what material the balls are made, may be of marble).

I wish to set these settings just like the material the balls are made of.

any best suggestions?

thanks

384391--13256--$picture_1_641.png

There is just one thing to say. Try it out!
It is very time consuming and often frustrating.