private static void SetUpTransformFollow(GameObject avatarComponent, VRTK_DeviceFinder.Devices device) { var photonView = avatarComponent.GetComponent <PhotonView>(); if (photonView == null) { Debug.LogError(string.Format("The network representation '{0}' has no {1} component on it.", avatarComponent.name, typeof(PhotonView).Name)); return; } if (!photonView.isMine) { return; } var transformFollow = avatarComponent.AddComponent <VRTK_TransformFollow>(); transformFollow.gameObjectToFollow = VRTK_DeviceFinder.DeviceTransform(device).gameObject; transformFollow.followsScale = false; /* * Work around stupid bug in VRTK_TransformFollow: * VRTK_TransformFollow only caches the transforms in OnEnable but we can't set * gameObjectToFollow before OnEnable is run, so we trigger it again here. * * This will be fixed in the future by @bddckr so the following isn't needed anymore. */ transformFollow.enabled = false; transformFollow.enabled = true; // Bug fix end. }
private static void SetUpTransformFollow(GameObject avatarComponent, VRTK_DeviceFinder.Devices device) { var transformFollow = avatarComponent.AddComponent <VRTK_TransformFollow>(); Debug.Log(VRTK_DeviceFinder.DeviceTransform(device).gameObject); transformFollow.gameObjectToFollow = VRTK_DeviceFinder.DeviceTransform(device).gameObject; transformFollow.followsScale = false; }
private static void SetUpControllerHandLink(GameObject avatarComponent, VRTK_DeviceFinder.Devices device) { var photonView = avatarComponent.GetComponent <PhotonView>(); if (photonView == null) { Debug.LogError(string.Format("The network representation '{0}' has no {1} component on it.", avatarComponent.name, typeof(PhotonView).Name)); return; } GameObject controller = VRTK_DeviceFinder.DeviceTransform(device).gameObject; GameObject actual = VRTK_DeviceFinder.GetActualController(controller); var link = actual.AddComponent <PhotonViewLink>(); link.linkedView = photonView; }
// Token: 0x06001BA2 RID: 7074 RVA: 0x00090B9B File Offset: 0x0008ED9B public static Transform DeviceTransform(VRTK_DeviceFinder.Devices device) { switch (device) { case VRTK_DeviceFinder.Devices.Headset: return(VRTK_DeviceFinder.HeadsetTransform()); case VRTK_DeviceFinder.Devices.LeftController: return(VRTK_DeviceFinder.GetControllerLeftHand(false).transform); case VRTK_DeviceFinder.Devices.RightController: return(VRTK_DeviceFinder.GetControllerRightHand(false).transform); default: return(null); } }
private static void SetUpTransformFollow(GameObject avatarComponent, VRTK_DeviceFinder.Devices device) { var transformFollow = avatarComponent.AddComponent <VRTK_TransformFollow>(); transformFollow.gameObjectToFollow = VRTK_DeviceFinder.DeviceTransform(device).gameObject; transformFollow.followsScale = false; /* * Work around stupid bug in VRTK_TransformFollow: * VRTK_TransformFollow only caches the transforms in OnEnable but we can't set * gameObjectToFollow before OnEnable is run, so we trigger it again here. * * This will be fixed in the future by @bddckr so the following isn't needed anymore. */ transformFollow.enabled = false; transformFollow.enabled = true; // Bug fix end. }
private static void SetUpTransformFollow(GameObject avatarComponent, VRTK_DeviceFinder.Devices device) { var photonView = avatarComponent.GetComponent <PhotonView>(); if (photonView == null) { Debug.LogError(string.Format("The network representation '{0}' has no {1} component on it.", avatarComponent.name, typeof(PhotonView).Name)); return; } if (!photonView.isMine) { return; } var transformFollow = avatarComponent.AddComponent <VRTK_TransformFollow>(); transformFollow.gameObjectToFollow = VRTK_DeviceFinder.DeviceTransform(device).gameObject; transformFollow.followsScale = false; }
private static void SetUpTransformFollow(GameObject networkRepresentation, VRTK_DeviceFinder.Devices device) { var photonView = networkRepresentation.GetComponent <PhotonView>(); if (photonView == null) { Debug.LogError(string.Format("The network representation '{0}' has no {1} component on it.", networkRepresentation.name, typeof(PhotonView).Name)); return; } if (!photonView.isMine) { return; } // Disable graphical representation. networkRepresentation.transform.GetChild(0).gameObject.SetActive(false); var transformFollow = networkRepresentation.AddComponent <VRTK_TransformFollow>(); transformFollow.gameObjectToFollow = VRTK_DeviceFinder.DeviceTransform(device).gameObject; transformFollow.followsScale = false; }