private void Reset() { #if UNITY_EDITOR InitSetupDeviceGameObjects(); BhapticsVRCHelper.ToggleCameraGizmos(false); #endif }
void OnDrawGizmos() { #if UNITY_EDITOR if (!enabled) { return; } if (anim == null) { return; } if (anim.avatar == null) { return; } if (avatarDescriptor == null) { return; } if (Selection.activeGameObject != null && Selection.activeGameObject == gameObject) { if (BhapticsVRCHelper.cameraGizmosActive) { BhapticsVRCHelper.ToggleCameraGizmos(false); } if (selectedDevice != null) { if (selectedDeviceType == BhapticsDeviceType.LeftHand || selectedDeviceType == BhapticsDeviceType.RightHand) { var joints = selectedDevice.GetComponentsInChildren <ParentConstraint>(); for (int i = 0; i < joints.Length - 1; ++i) { Gizmos.color = new Color(1f, 1f, 0f, 1f); Gizmos.DrawSphere(joints[i].transform.position, 0.01f); var targetBone = anim.GetBoneTransform(handBoneDic[i + (int)selectedDeviceType * 10]); if (targetBone != null) { Gizmos.color = new Color(0f, 1f, 0f, 1f); Gizmos.DrawSphere(targetBone.position, 0.01f); } } } else { Gizmos.color = new Color(1f, 1f, 0.5f, 0.1f); var skin = selectedDevice.GetComponentInChildren <SkinnedMeshRenderer>(); if (skin != null) { Gizmos.DrawWireMesh(skin.sharedMesh, skin.transform.position, skin.transform.rotation, skin.transform.lossyScale); } else { var meshFilter = selectedDevice.GetComponentInChildren <MeshFilter>(); if (meshFilter != null) { Gizmos.DrawWireMesh(meshFilter.sharedMesh, meshFilter.transform.position, meshFilter.transform.rotation, meshFilter.transform.lossyScale); } } } } } else { if (!BhapticsVRCHelper.cameraGizmosActive) { BhapticsVRCHelper.ToggleCameraGizmos(true); } } #endif }
void OnDestroy() { #if UNITY_EDITOR BhapticsVRCHelper.ToggleCameraGizmos(true); #endif }