- Home /
How to add equal force across multiple platforms
My problem is that when I add force like this
rigidbody.AddRelativeForce(Vector3.forward * 100, ForceMode.Acceleration );
based on the computing power of the computer the game in runing on the Game object will move faster or slower based on the frame rate or time of the game. I would like to know what I can do to make it so even thou the frame rate is less or higher the GameObject will always move at the same velocity.I would really appreciate if someone can help with this. all the information out there is very contradicting some people say is ok to multiply force by Time and some say that's not a good thing to do let me know what you think.
Answer by randosity · May 11, 2014 at 03:31 AM
For moving rigid bodies you should be adding force in FixedUpdate(), and then multiplying the force by Time.fixedDeltaTime.
so is this what I would end up with ?rigidbody.AddRelativeForce(Vector3.forward * Time.fixedDeltaTime );
not sure what that line would look like
Since 'Time.fixedDeltaTime' is a constant, you can use it or not. The line might look like:
rigidbody.AddRelativeForce(Vector3.forward * amount);
Where 'amount' is the amount of force you want to apply each fixed frame. Using FixedUpdate(), your game should behave similarly across different platforms.
Your answer
Follow this Question
Related Questions
Constant force on 2Drigidbodys 0 Answers
Why does writing to rigidbody.velocity after AddForce stop my rigidbody moving? 4 Answers
Rigidbody Disable Velocity/Movement? 1 Answer
Projectile not 'projecting' because i have to use "var xxx : GameObject = Instantiate" 2 Answers
Rigidbody.AddForce not working 1 Answer