Solve the problem of inaccurate movement when the CameraRig position is forced to move instantaneously (VRTK)
![Solve the problem of inaccurate movement when the CameraRig position is forced to move instantaneously (VRTK) Solve the problem of inaccurate movement when the CameraRig position is forced to move instantaneously (VRTK)](http://up-free-imgs.azimiao.com/wp-content/uploads/2017/10/imageUnityOk02.jpg)
reason
resolvent
//Extracted from VRTK_BasicTeleport script of development version protected virtual Vector3 GetCompensatedPosition(Vector3 givenPosition, Vector3 defaultPosition) { float newX = 0f; float newY = 0f; float newZ = 0f; if (ValidRigObjects()) { newX = (headsetPositionCompensation ? (givenPosition.x - (headset.position.x - playArea.position.x)) : givenPosition.x); newY = defaultPosition.y; newZ = (headsetPositionCompensation ? (givenPosition.z - (headset.position.z - playArea.position.z)) : givenPosition.z); } return new Vector3(newX, newY, newZ); }
VRTK out of the box approach
//Transfer (including processing of offset) //Parameters: target: destination object (mark, useless in blink), destinationPosition: blink world coordinate, destinationRotation: rotation, forceDestinationPosition: blink whether the target point changes public virtual void Teleport(Transform target, Vector3 destinationPosition, Quaternion? destinationRotation = null, bool forceDestinationPosition = false) //Forced transfer (including processing of offset), ignoring collision, obstruction, floor, etc //Parameters: destinationPosition: world coordinate point to be moved, destinationRotation: rotation to be performed teleporter.ForceTeleport(Vector3 destinationPosition, Quaternion? destinationRotation = null);
References