public void DoTeleport() { Quaternion?rotation = null; if (rotate) { var rotationY = rotationAbsolute ? transform.rotation.eulerAngles.y : VectorUtils.AngleOffAroundAxis(transform.forward, VRTK_DeviceFinder.HeadsetTransform().forward, Vector3.up); rotationY += VRTK_SDKManager.instance.transform.rotation.eulerAngles.y; rotation = Quaternion.Euler(0, rotationY, 0); } var playAreaTeleport = teleport as PlayAreaLimitedTeleport; bool originalCheckForCollisions = false; if (playAreaTeleport) { originalCheckForCollisions = playAreaTeleport.checkForCollisions; playAreaTeleport.checkForCollisions = false; } teleport.skipBlink = true; teleport.Teleport(transform, transform.position, rotation); teleport.skipBlink = false; headsetEat.enabled = true; Destroy(gameObject); if (playAreaTeleport) { playAreaTeleport.checkForCollisions = originalCheckForCollisions; } }
public void DoSnapToFloor() { if (!enabled) { return; } var player = VRTK_DeviceFinder.HeadsetTransform(); if (!player) { return; } var playAreaTeleport = teleport as PlayAreaLimitedTeleport; bool originalValue = false; if (playAreaTeleport) { originalValue = playAreaTeleport.GetOnlyTeleportToPointers(); playAreaTeleport.SetOnlyToPointers(false); } teleport.Teleport(floor, player.position + offset); enabled = !disableOnUse; if (keepTeleportToPointerValue && playAreaTeleport) { playAreaTeleport.SetOnlyToPointers(originalValue); } }
private void Rotate() { if (playArea != null && headset != null) { Debug.Log(playArea.gameObject); basicTeleport.Teleport(playerTracker.transform, playerTracker.transform.position, playArea.rotation * Quaternion.Euler(rotation)); } }
private void Teleport(Vector3 position, Quaternion rotation, bool forceDestination, Color fadeColor) { Teleporter.blinkToColor = fadeColor; Teleporter.Teleport(transform, position, rotation, forceDestination); Teleporter.blinkToColor = Color.black; }