I have a tracker attached to a players foot.
I want to be able to calibrate the system so that when the player has their foot flat on the floor the VR foot will be flat too.
I know the world rotation of the flat foot in VR and have defined it as Vector3 flatFootRotation
The world rotation of the tracker when the foot is flat is given by tracker.rotation
at the time of calibration.
First, I determine the offset between the tracker and the foot:
offset = Quaternion.FromToRotation( tracker.rotation * Vector3.forward, Quaternion.Euler(flatFootRotation) * Vector3.forward);
From then on, I set the rotation of the foot according to the trackers rotation, plus an offset.
VRfoot.rotation = tracker.rotation*offset;
When the rotation of the tracker is unchanged from the calibration step, I expect that the VR foot will be flat on the floor. This does not happen and the foot has an unexpected rotation.
I have tried reversing the order of all of these operations and have also tried using the inverse instead. Nothing works.