Attempting an infinite 2d runner, but when I use rigibody2D.addforce it slowly accelerates to insanely fast regardless of what I multiply it by...
enter code here#pragma strict
var myForce : float = 20;
var jumpForce : float = 600;
function Update()
{
if(Input.GetKeyDown(KeyCode.Space))
{
rigidbody2D.AddForce(new Vector2(0, jumpForce ));
}
}
function FixedUpdate () {
rigidbody2D.AddForce(new Vector2(myForce, 0));
};
Even if I change myForce to 10 it starts slowly and eventually picks up crazy amounts of speed. All I want is a constant movement speed. Thanks in advance.
↧