I’m creating a simple platformer, and I’m moving my character by applying force
if (Input.GetKey ("right")) {
rigidbody.AddForce (Vector3.forward * 10);
}
When testing with player settings, and quality it turns out that the player on fastest, and below beautiful settings will zoom about the screen, and not at the set pace.
Any suggestions on how I can limit the speed, or would it be best to just set all Quality Setting in the Inspector to the same?
If you’re not adding force with some fixed number of times per second, you’ll have a similar issue: the faster the game runs, the more often your update loop will fire, the more force you’ll be adding. If you’re not careful, that can come back to bite you.
If you’re willing to spend some time implementing actual kinematics for your character’s movement (acceleration, velocity, and so on), that should solve your problem. If you’re looking for more of a quick fix, multiplying your force by frame time will help but probably won’t completely fix the problem.
Bear in mind that Time.deltaTime is usually a very small value, around 0.02 to 0.05 depending on your performance, and that you’ll probably want to increase your other constants once you add the coefficient.