Reputation: 11712
I'm creating Unity2D runner where characters is running on the ground. I'm trying to force him run with constant speed by applying force with right vector but the movement is jerky.
I'm trying to achieve effect of endless run with permanent speed. It is easy in the air but works different (because of physics) when character is running on the ground.
Upvotes: 0
Views: 5585
Reputation: 347
EDIT:
To implement this yourself. You can update the position of the object in the update method. Something like
Vector3 temp = object.transform.position;
temp.x = speed * Time.deltaTime;
object.transform.position = temp;
Where object is you runner and speed is how fast you would like him to move. This would be inside the update function.
Upvotes: 1
Reputation: 15951
Use Rigidbody2D.velocity and pay attention to:
The velocity can also gradually decay due to the effect of drag if this is enabled.
Upvotes: 1