- Home /
How to make Jump() framerate independent?
Jump became slower on mobile devices and it differs from mobile to mobile. void Jump(){ rb.velocity = Vector3.up.normalized * power; //or //rb.addForce(Vector3.up.normalized * power); }
I'm thinking how can I make a jump behaviour in FixedUpdate()
Answer by MT369MT · May 23, 2018 at 05:01 AM
Hi, Add Time.deltaTime to your code and it will be frame independent. void Jump () { rb.velocity = Vector3.up.normalized power Time.deltaTime; //note that you can also delete .normalize beacause Vector3.up is already (0, 1) and if you normalize it it will stay still the same. }
How that become frame independent since it is not called in any Update method? And why Time.deltaTime I thought it should be fixedDeltaTime since we are dealing with physics? But your answer works like a charm. weird.
Your answer
Follow this Question
Related Questions
Problems with Physics(Flipping strangely) 2 Answers
ForceMode.VelocityChange vs. simply adding to .velocity 0 Answers
Setting a RigidBody's velocity messes with my custom gravity, not sure how to proceed. 0 Answers
Any way to gracefully detach object with Unity physics? 2 Answers
Moving rigidbody (Player) with addForce or Velocity ? 1 Answer