void Awake() { capCollider = GetComponent <CapsuleCollider>(); manager = FindObjectOfType <HapticManager>(); // Calculate the local positions of the ends of the collider switch (capCollider.direction) { // X Axis case 0: CalculateColliderEndPoints(transform.InverseTransformDirection(transform.right)); break; // Y Axis case 1: CalculateColliderEndPoints(transform.InverseTransformDirection(transform.up)); break; // Z Axis case 2: CalculateColliderEndPoints(transform.InverseTransformDirection(transform.forward)); break; } }
void Start() { hapticManager = FindObjectOfType <HapticManager>(); bodyPartList = Enum.GetValues(typeof(HumanBodyBones)).Cast <HumanBodyBones>().ToList(); SetDropdownOptions(patternDropdown, availablePatterns.Select(P => P.name).ToList(), true); SetDropdownOptions(bodyPartDropdown, bodyPartList.Select(P => P.ToString()).ToList(), true); // Make sure the functions are invoked once so the pattern isnt' null DropdownPatternSelection(patternDropdown); DropdownBodyPartSelection(bodyPartDropdown); }
protected void Awake() { targetManager = target as HapticManager; hapticSystemAndDevices = new Dictionary <string, List <HapticDeviceInfo> >(); hapticSystemEditorInfo = new Dictionary <string, HapticSystemEditorInfo>(); // Get all the haptic device classes in the project foreach (Type type in Assembly.GetAssembly(typeof(HapticDevice)).GetTypes()) { object[] attributeList = type.GetCustomAttributes(typeof(HapticSystemAttribute), true); if (attributeList.Length > 0) { foreach (object currentAttribute in attributeList) { HapticSystemAttribute hapticAttribute = currentAttribute as HapticSystemAttribute; if (!hapticSystemAndDevices.ContainsKey(hapticAttribute.SystemName)) { hapticSystemAndDevices.Add(hapticAttribute.SystemName, new List <HapticDeviceInfo>() { new HapticDeviceInfo(hapticAttribute, type) }); hapticSystemEditorInfo.Add(hapticAttribute.SystemName, new HapticSystemEditorInfo()); } else { hapticSystemAndDevices[hapticAttribute.SystemName].Add(new HapticDeviceInfo(hapticAttribute, type)); } } } } // Use EditorPrefs to find the devices that are being used by the developer foreach (KeyValuePair <string, List <HapticDeviceInfo> > currentDevice in hapticSystemAndDevices) { for (int n = 0; n < currentDevice.Value.Count; n++) { currentDevice.Value[n].isSelected = EditorPrefs.GetBool(Constants.EditorPrefLocation + currentDevice.Key + "." + currentDevice.Value[n].systemAttribute.DeviceName); } } useVisualizer = EditorPrefs.GetBool(Constants.EditorPrefLocation + "UseVisualizer"); }
void Start() { manager = FindObjectOfType <HapticManager>(); // Hook into every device's event in the scene to know when they play a haptic pulse foreach (HapticDevice hapticDevice in manager.GetSetOfActiveDevices()) { hapticDevice.HapticFeedbackPlayed += HapticDevice_HapticFeedbackPlayed; } // Grab all the body coordinates below this script in the hierarchy and save a reference to it bodyPartToCoordinate = new Dictionary <HumanBodyBones, BodyCoordinate>(); foreach (BodyCoordinate bodyCoordinate in GetComponentsInChildren <BodyCoordinate>()) { if (!bodyPartToCoordinate.ContainsKey(bodyCoordinate.attachedBody)) { bodyPartToCoordinate.Add(bodyCoordinate.attachedBody, bodyCoordinate); } } }
protected virtual void Start() { manager = FindObjectOfType <HapticManager>(); if (manager == null) { Debug.LogWarning("No HapticManager found in scene. Please add a Haptic Manager to the scene."); enabled = false; } else { manager.AddDevicePerBodyLocation(this, affectedBodyPart); } // Since some types aren't serializable, use this method to rebuild them from serialized data hapticSystemInfo.ResetAfterSerialization(); if (hapticSystemInfo.ConnectedSDKType != null) { VRTK_SDKManager.instance.LoadedSetupChanged += Instance_LoadedSetupChanged; } }