# Stop the player to prevent it from being thrown away after collision

I'm trying to write a script where when the player (kinematic) comes up against an enemy he stops, jumps and gets dynamic again. The problem is that when it returns dynamic it is thrown away and does not fall towards the floor. I keep looking but I can't find a solution.

This is the code I wrote:

private void OnCollisionEnter2D(Collision2D collision)

{
if(collision.collider.tag == "Enemy")
{
rb.velocity = Vector2.zero;

rb.isKinematic = false;

Jump(Vector2.up);
//rb.isKinematic = false;
}
}

private void Jump(Vector2 dir)
{
rb.velocity += dir * jumpForce;
}

• Have you tried velocity = rather than +=? It's possible your kinematic body has accumulated a larger velocity than you expect. Another possibility is that the player's collider is embedded in the ground/enemy at the time of the switch, forcing the physics engine to apply a large impulse to separate them. Have you tried changing its physics layer or using IgnoreCollision to eliminate this possibility? – DMGregory Aug 23 '19 at 13:38