private void OnEnable() { collisionTracker = GetComponent <CollisionTrackerNew>(); collisionTracker.CollisionStarted.AddListener(touch.NotifyTouched); collisionTracker.CollisionChanged.AddListener(touch.NotifyTouchChanged); collisionTracker.CollisionStopped.AddListener(touch.NotifyUnTouched); if (PrimaryActionEvent == null) { PrimaryActionEvent = this.GetPrimaryAction; } if (SecondaryActionEvent == null) { SecondaryActionEvent = this.GetSecondaryAction; } }
private void OnEnable() { touch.touchedObjects = new List <GameObject>(); grab.grabbedObjects = new List <InteractableRaw>(); collisionTracker = GetComponent <CollisionTrackerNew>(); if (!inputManager) { inputManager = GetComponent <InputManagerNew>(); } if (!inputManager) { inputManager = GetComponentInChildren <InputManagerNew>(); } if (!mainObject) { mainObject = gameObject; } if (!mainRigidbody) { mainRigidbody = GetComponent <Rigidbody>(); } if (!velocityTracker) { velocityTracker = gameObject.GetComponent <VelocityTracker>(); if (!velocityTracker) { velocityTracker = gameObject.AddComponent <VelocityTracker>(); } } touch.parent = this; grab.parent = this; }