private void AddFixedJointToController(InteractionController controller)
        {
            FixedJoint fx = controller.gameObject.AddComponent <FixedJoint>();

            fx.breakForce    = 1500;
            fx.connectedBody = rb;
        }
示例#2
0
 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;
        }
示例#6
0
 public virtual void OnTriggerWasReleased(InteractionController controller)
 {
     currentController = null;
 }
示例#7
0
 public virtual void OnTriggerIsBeingPressed(InteractionController controller)
 {
 }