add force dealy ???

i have one character like sphere with jump animation & i try put following input to this sphere but its not working perfectly

**function Update () {



but problem is when i hold the key then my character go up & up i want movement like this image (image is not perfect but i think its enough for the understand movement)

maybe this is a wrong way is that any simple way to do this movement with animation


alt text

The problem is you are applying that force every update when you hold the key down. What you probably want to do is check if the rigidbody is sleeping, then apply the force. e.g.

function Update () {

if(Input.GetAxis("Horizontal") && transform.rigidbody.IsSleeping())


This way you won't be able to apply the force unless the rigidbody is still. There are various other checks you could do if this is not the intended behaviour, but this will allow the ball to bounce like your picture, and won't accept any more forces until is has come to rest again.

thanks Murcho but the problem is this sphere movement is very slow he take some time to add another force how can i decrease the this time

i was trying this...... is that right or wrong i don't know help me

var speed =50.0;
var raydist = 1.0;
var rayoffset = 1.0;
static var maxspeed = 5.0;
var airxspeedfactor = 2;
var jumpforce = 1000;
static var grounded = 1;

function FixedUpdate ()
transform.position.z = 0;
//print (rigidbody.velocity.x);
if (Physics.Raycast ((transform.position+ Vector3 (rayoffset, rayoffset, rayoffset)), Vector3 (0, -1, 0), raydist))
print ("Grounded");
grounded = 1; 
//transform.rigidbody.AddForce((Input.GetAxis("Horizontal") * speed), 0, 0);
 if (Input.GetAxis("Horizontal")) {

//rigidbody.velocity.x = Mathf.Clamp(rigidbody.velocity.x, -maxspeed, maxspeed);
//  if (Input.GetButtonDown("Vertical"))
//  {
//  transform.rigidbody.AddForce(0, jumpforce, 0);
//  }

print ("Clear");
grounded = 0;
//transform.rigidbody.AddForce((Input.GetAxis("Horizontal") * speed / airxspeedfactor), 0, 0);
//rigidbody.velocity.x = Mathf.Clamp(rigidbody.velocity.x, -maxspeed, maxspeed);
//rigidbody.drag = 0;