something is wrong in my game.Please help

hey, i am creating a game. It is a simple game where you should rotate and jump a ball on a ground
so here is my code:
#pragma strict

var rotationSpeed = 100;
var jumpHeight = 8;

private var isFalling = false;

function Update ()
{
	//Handle ball rotation.
	var rotation : float = Input.GetAxis ("Horizontal") * rotationSpeed;
	rotation *= Time.deltaTime;
	GetComponent.<Rigidbody>().AddRelativeTorque (Vector3.back * rotation);
	
	 if (Input.GetKeyDown (KeyCode.W) && isFalling == false)
	{
		GetComponent.<Rigidbody>().velocity.y = jumpHeight;
	}
	isFalling = true;
}

function OnCollisionStay ()
{
	isFalling = false;
}

but i am having a problem, after few seconds of launching my game the ball deviate from axis and fall down from the platform.
please i need your help.

1 Answer

1

the ball deviate from axis and fall
down from the platform

What does this mean? Do you mean the sphere falls through the platform?

Does the platform have a RigidBody attached with isKinematic set to true?