# how to give force to ball from slow to fast....?

Hey guys… I have a game in which I am giving force to the ball(sphere) by

``````		rigidbody.AddForce (new Vector3 (0, 0, BallSpeed), ForceMode.Impulse);
``````

in which BallSpeed is the public variable that is used to give value from the script inspector. If I keep smaller or less value of BallSpeed variable, then the ball won’t reach the desired distance and stop in between the way. and if I put larger value then the ball goes speed like bullet of gun(actually not as fast as bullet, but goes very fast in just a second).
So what I wanna do is that I wanna give force to the ball so that it can startup slowly and reach the desired destination with the same force. There are gameobjects in front of the ball. So i want to let them down by my ball. but want to throw my ball slowly but at the time of the collision with the gameobject, the force should remain same(Like bowling ball which thrown slowly but falls the pins very easily). So I want to do the same like bowling ball force…!

Sorry for my poor english guys… any suggestion/solution appreciated!

Hi,

If BallSpeed is your final value, you need to multiply it by a value between 0 and 1 and make this value start at 0 and gradually rise to 1.

``````float coeff = 0.1f;

void Update () {
if (coeff < 1){
coeff *= 1.06; //find by how much you want to rise it at each frame
// or coeff = Mathf.Sqrt(1.5f * coeff)
// ... it depends on which shape of accel you want
}
rigidbody.AddForce (new Vector3(0, 0, coeff * BallSpeed), ForceMode.Impulse);
}
``````