protected override void OnManipulationUpdated(GameObject obj, InteractionManager.InteractionEventArgs eventArgs) { base.OnManipulationUpdated(obj, eventArgs); if (!acceptInput) { return; } if (target == null) { return; } if (!manipulatingNow) { return; } Vector3 eventPos = eventArgs.Position; // Transform the direction if necessary if (eventArgs.IsPosRelative) { eventPos = Veil.Instance.HeadTransform.TransformDirection(eventPos); } // See how much our position has changed navigateVelocity = lastNavigatePos - eventPos; lastNavigatePos = eventPos; smoothVelocity = Vector3.Lerp(smoothVelocity, navigateVelocity, 0.5f); }
protected override void OnManipulationCompleted(GameObject obj, InteractionManager.InteractionEventArgs eventArgs) { ManipulatingNow = false; base.OnManipulationCompleted(obj, eventArgs); }
/// <summary> /// Chooses our manipulation handle so we know how to interpret future input events /// </summary> /// <param name="obj"></param> /// <param name="eventArgs"></param> protected override void OnManipulationStarted(GameObject obj, InteractionManager.InteractionEventArgs eventArgs) { base.OnManipulationStarted(obj, eventArgs); TryToSetHandle(obj, eventArgs.Position, eventArgs.Focuser); }