Functioning ways for VR controller movement input?

I use movement of VR controllers and their positions and rotations for input to add force and torque to player rigidbody. I also need to make transformations between local and world space. What is the best way for such controls?

Do I have to cycle everything needed for calculations through OnInput like in Dragonhunters VR-example (game did not seem to sync correctly between clients when using positions directly, even that they have NetworkTransform)?

For example I cannot use XRRig.transform.TransformPoint directly, but either analyze the result in OnInput for sending or send XRRig position and rotation and make a corresponding function after GetInput (transforms cannot be send)? Or cannot use for example XRRig.transform.up for torque axis but create corresponding vector from rotation from GetInput (or alternatively send vector in OnInput).

Answers

  • NetworkTransform synchronizes positions from the state authority (server) to the clients but not the other way around. Any transform that is needed for your movement needs to be sent to the server for the client so that the server can simulate it as well and match the clients prediction. That means yes you have to include it in the NetworkInput or if it is an infrequent input you can use an RPC instead.