private void AddFixedJointToController(InteractionController controller) { FixedJoint fx = controller.gameObject.AddComponent <FixedJoint>(); fx.breakForce = 1500; fx.connectedBody = rb; }
public virtual void OnTriggerWasPressed(InteractionController controller) { currentController = controller; foreach (GameEvent gameEvent in onInteractEvents) { gameEvent.Raise(); } }
private void RemoveFixedJointFromController(InteractionController controller) { if (controller.gameObject.GetComponent <FixedJoint>()) { FixedJoint fx = controller.gameObject.GetComponent <FixedJoint>(); fx.connectedBody = null; Destroy(fx); } }
public override void OnTriggerWasPressed(InteractionController controller) { base.OnTriggerWasPressed(controller); if (hideControllerModelOnGrab) { controller.HideControllerModel(); } controller.Vibrate(800); AddFixedJointToController(controller); }
public override void OnTriggerWasReleased(InteractionController controller) { base.OnTriggerWasReleased(controller); if (hideControllerModelOnGrab) { controller.ShowControllerModel(); } RemoveFixedJointFromController(controller); Transform rig = controller.GetComponentInParent <SteamVR_ControllerManager>().gameObject.transform; rb.velocity = rig.TransformDirection(controller.velocity); rb.angularVelocity = controller.angularVelocity; }
public virtual void OnTriggerWasReleased(InteractionController controller) { currentController = null; }
public virtual void OnTriggerIsBeingPressed(InteractionController controller) { }