Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
Anonymous's avatar
Anonymous
11 years ago

Bug in OVRPlayerController - inconsistent move speed

I found a bug in this code (exists in both 0.1.0 and 0.1.2 utils) in OVRPlayerController that will end up causing inconsistent movement speed between DK1, DK2, and CV1 headsets, since this bug makes the speed be affected by frame rate. DK1 will have faster move speed than DK2, and DK2 faster than CV1.


line 256: MoveScale *= SimulationRate * Time.deltaTime;



line 317: moveInfluence = SimulationRate * Time.deltaTime * Acceleration * 0.1f * MoveScale * MoveScaleMultiplier;


moveInfluence is therefore proportional the square of Time.deltaTime instead of Time.deltaTime as was likely intended to make the code framerate independent. This extra multiply of SimulationRate * Time.deltaTime going to cause DK1, DK2, and CV1 versions to all have different response rates to the controller.

Correct fix is to remove 2nd Simultation Rate * Time.deltaTime multiplier (since MoveScale already accounts for this):


line 317: moveInfluence = Acceleration * 0.1f * MoveScale * MoveScaleMultiplier;


Just wanted to give people a heads up that about this as it would definitely impact gameplay. I noticed this because during an occasional game glitch (frame took really long), the movement speed would spike way up and seem to teleport the player. This was due to the double multiply by Time.deltaTime. Fixing the code above also fixes that issue.

ccs

4 Replies

Replies have been turned off for this discussion
  • Ah thanks for this, i've had the spike/teleport issue for some time and i could never figure out what was causing it
    good job!
  • Anonymous's avatar
    Anonymous
    Really glad to see someone found this bug! thank you... I thought it was an issue with my setup and SECTR streaming. I havent used the OVR controllers in a while for this reason. I would load a stream chunk and my player would shoot across the area. This doesnt happen with a rigidbody ayer controller.
    Thanks!
  • "ccs" wrote:
    moveInfluence = SimulationRate * Time.deltaTime * Acceleration * 0.1f * MoveScale * MoveScaleMultiplier;

    Thanks. This line should be:
    moveInfluence = Acceleration * 0.1f * MoveScale * MoveScaleMultiplier;

    We've fixed it for an upcoming release.