Physics results vary depending on load

Hi there,
I am using physics to push my character along, and it seems to work okay but the results I am getting vary depending on the load that the device is under.
In unity it’s pretty consistent but on the iPhone if the device is under load it might push the character heaps more than it should.

This is the code I have to provide the push for the character, it’s sitting inside a function, can anyone see why this would be inconsistent, and perhaps suggest another more solid approach?

		constantForce.relativeForce.x = ((Boost))*-Direction;
		yield new WaitForSeconds (.1);
		constantForce.relativeForce.x = 0

Thanks
Pete

You shouldn’t do physics-related stuff outside FixedUpdate - at least not things that are delta-time sensitive. Unity may not be able to hit that yield perfectly at the same interval each time because I think it waits for the next Update* (which is framerate-dependant), but you could try to use WaitForFixedUpdate together with
Time.fixedTime if you really don’t want to do it in FixedUpdate.

*Correct me if I’m wrong, anyone :slight_smile:

hey ToreTank, thanks for that. Now I am multiplying things by Time.fixedDeltaTime and it seems to be pretty stable :slight_smile: