private void onHeadsetUpdate(Matrix4x4 leftProjectionMatrix, Matrix4x4 rightProjectionMatrix, Matrix4x4 leftViewMatrix, Matrix4x4 rightViewMatrix, Matrix4x4 sitStandMatrix) { Matrix4x4 trs = WebXRMatrixUtil.TransformViewMatrixToTRS(leftViewMatrix); this.headRotation = WebXRMatrixUtil.GetRotationFromMatrix(trs); this.headPosition = WebXRMatrixUtil.GetTranslationFromMatrix(trs); this.sitStand = sitStandMatrix; }
private void onControllerUpdate(string id, int index, string handValue, bool hasOrientation, bool hasPosition, Quaternion orientation, Vector3 position, Vector3 linearAcceleration, Vector3 linearVelocity, WebXRControllerButton[] buttonValues, float[] axesValues) { if (handFromString(handValue) != hand) { return; } SetVisible(true); Quaternion sitStandRotation = WebXRMatrixUtil.GetRotationFromMatrix(sitStand); Quaternion rotation = sitStandRotation * orientation; if (!hasPosition || simulate3dof) { position = applyArmModel( sitStand.MultiplyPoint(headPosition), rotation, headRotation); } else { position = sitStand.MultiplyPoint(position); } _t.localPosition = position - Vector3.up * 1.0f; /**/; _t.localRotation = rotation; _t.localRotation *= Quaternion.Euler(fixupAngle); /**/ UpdateButtons(buttonValues); axes = axesValues; }