physics vastly different between using vr and not using vr

making a multiplayer vr game here, and for testing purposes, i am able to play the game in a non-vr way, with the mouse and keyboard.

i’ve noticed though, that the physics engine behaves very differently depending on if i’m using vr or not. can anyone illuminate what might be happening here?

i have a ball launcher that applies a one-time force on a ball. the non-vr client sees the ball launch probably 2x or 3x as far as the vr client. aside from using/not using vr, the code is all identical.

edit: note that both test cases are inside the unity editor.

also - vr generally stays locked at 90fps, while the non-vr version runs at around 400fps, according to the unity stats window. i tried setting Application.targetFrameRate to 90 for both, and the problem still remains.

heh ok figured it out. steamvr sets Time.fixedDeltaTime every update to 1/90, but that’s not what the physics step is set to by default. if i set my non-vr client’s Time.fixedDeltaTime to 1/90, the results are spot on

This just means probably, you’re not really multiplying things by fixedDelta in fixed update :smile: No harm done if you’re happy using 1/90 everywhere though!

i apply a force as a one time event and let the physics engine do whatever to it - no multiplying on my part. so yeah, i’m totally fine with using 1/90th everywhere. in practice, my game will be VR only anyways - i just need the non-vr client to have somewhat consistent results for testing purposes (for now lol. maybe someday i’ll make a game where vr and non-vr people can play together…). thanks!

I believe Application.targetFrameRate doesn’t work in the editor, only in actual builds.

1 Like