adding force to rigidbodys i collide with

// Make all rigidbodies we touch fly upwards
function OnCollisionStay(collision : Collision) {
    // Check if the collider we hit has a rigidbody
    // Then apply the force
    if (collision.rigidbody) {
        collision.rigidbody.AddForce (Vector3.up * 15);
    }
}

i got this from the scripting reference in the docs, and it wont work, i checked to see if its entering the if statement and it is, but the rigid body wont go upwards

what am i doing wrong??

Most likely the force is too small. Try changing it to this and giving it a large force in the inspector.

var force = 0.00;

// Make all rigidbodies we touch fly upwards
function OnCollisionStay(collision : Collision) {
    // Check if the collider we hit has a rigidbody
    // Then apply the force
    if (collision.rigidbody) {
        collision.rigidbody.AddForce (Vector3.up * force);
    }
}

i tried that before posting actually, it still didn’t work

Make sure “Is Kinematic” isn’t ticked in your inspector.

nope,its not ticked on either object

Try adding a print in there to see if it is actually being called?

yeah its called, i did that before i posted

hmmmm, i still cant get it to work, i have no idea what i could possibly be doing wrong

Try OnCollisionEnter

You’re not specifying a force mode. If you make your third parameter ForceMode.Force, it should apply that force instantly over one frame. It’s probably applying that force over time, making it super weak.

Is your collider of the object maybe under another collider, so it is trying to force it up but it get stuck at another collider?