Velocity different when sidecolission 2d?

#pragma strict

var jumpHeight = 10;
var isFalling = false;
var moveSpeed = 8;
var sideCollision = false;


function Start ()
{

}

function Update ()
{
    //Player move right
    rigidbody2D.velocity.x = moveSpeed;
   
    //Player movement
    if (Input.GetKeyDown(KeyCode.Space) && isFalling == false)
    {
        rigidbody2D.velocity.y = jumpHeight;
    }
    isFalling = true;
   
   
    //roof collision
    if (Input.GetKey(KeyCode.Space) && sideCollision == false)
    {
        rigidbody2D.velocity.y = jumpHeight;

    }
    sideCollision = true;

}

function OnCollisionStay2D ()
{
    isFalling = false;
    sideCollision = false;
}

it is different when is on the second platform…

you never actually reset the bools to false in the OnCollisionStay2D() …

I think you were looking for OnCollisionStay2D(Collision2D)

if you don’t have the parameter in there it’s a different function (might want to read up on polymorphism: Polymorphism (computer science) - Wikipedia) if it’s not the right function the unity engine wont call it.

but i dont know how… beacue i do all and the velocity always is different ;(

iupppppp