- Home /
AddForce applies different amount on Android than PC
My player jumps much higher on android device, than it does on PC.
Here is my Jump code for my player:
public void jump(){
if(gScript.getJumpCount() < 2){
rigidbody.AddForce (Vector3.up*4f,ForceMode.VelocityChange);
rigidbody.useGravity = true;
}
}
This is called in FixedUpdate()
Hope you can help. Thanks in advance, Jack.
This is just a wild guess, but could this be framerate dependent? You add just an impulse and if a frame lasts longer (e.g. the framerate is lower, for example on an Android device) it could be that the effect is more severe.
If this is the case, you would have to divide the 4f by the deltaTime factor. Before you try that, you should verify the assumption though. :-)
Thanks for replying Gnometech. I have tried using the Time.deltaTime & Time.fixedDeltaTime. When applying, it still has the same affect.
Update: It was a frame rate issue. PC was much higher than android device. I have locked the frame rate to 30, and all seems to working well. Thanks for pointing me in right direction Gnometech.
$$anonymous$$ore than a wild guess this is common as fuck, the problem is that it's frame dependent.
I'm puzzled by this being frame rate dependent. I don't doubt you, but I don't understand it. Fixed Timestep should be the same on both platforms. You say you used FixedUpdate(). Any reference to Time.deltaTime is converted to Time.fixedDeltaTime inside FixedUpdate(). If you understand the issue, I'd like to know.
Your answer
Follow this Question
Related Questions
Jump Height Different On Android 0 Answers
Platform switching 1 Answer
Should I use Unity in this project 2 Answers
Using your Android as a controller for your Unity PC Game 1 Answer
Add force to an arrow 1 Answer