Exemplo n.º 1
0
 public override void TriggerUp()
 {
     base.TriggerUp();
     meteorObj.GetComponent <Meteor>().SetActive();
     meteorObj.GetComponent <Rigidbody>().velocity = 5f * ControllerPose.GetVelocity(InputSource);
     Debug.Log(ControllerPose.GetVelocity(InputSource));
 }
 public static ControllerPose Interpolate(ControllerPose from, ControllerPose to, float time)
 {
     return(new ControllerPose {
         button1IsDown = time < 0.5f ? from.button1IsDown : to.button1IsDown,
         button2IsDown = time < 0.5f ? from.button2IsDown : to.button2IsDown,
         joystickPosition = Vector2.Lerp(from.joystickPosition, to.joystickPosition, time),
         indexTrigger = Mathf.Lerp(from.indexTrigger, to.indexTrigger, time),
         gripTrigger = Mathf.Lerp(from.gripTrigger, to.gripTrigger, time),
     });
 }
Exemplo n.º 3
0
 public static ControllerPose Interpolate(ControllerPose a, ControllerPose b, float t)
 {
     return(new ControllerPose
     {
         button1IsDown = t < 0.5f ? a.button1IsDown : b.button1IsDown,
         button2IsDown = t < 0.5f ? a.button2IsDown : b.button2IsDown,
         joystickPosition = Vector2.Lerp(a.joystickPosition, b.joystickPosition, t),
         indexTrigger = Mathf.Lerp(a.indexTrigger, b.indexTrigger, t),
         gripTrigger = Mathf.Lerp(a.gripTrigger, b.gripTrigger, t),
     });
 }
Exemplo n.º 4
0
 public static ControllerPose Interpolate(ControllerPose a, ControllerPose b, float t)
 {
     return(new ControllerPose
     {
         buttons = t < 0.5f ? a.buttons : b.buttons,
         touches = t < 0.5f ? a.touches : b.touches,
         joystickPosition = Vector2.Lerp(a.joystickPosition, b.joystickPosition, t),
         indexTrigger = Mathf.Lerp(a.indexTrigger, b.indexTrigger, t),
         handTrigger = Mathf.Lerp(a.handTrigger, b.handTrigger, t),
         isActive = t < 0.5f ? a.isActive : b.isActive,
     });
 }
Exemplo n.º 5
0
 public static PoseFrame Interpolate(PoseFrame a, PoseFrame b, float t)
 {
     return(new PoseFrame
     {
         headPosition = Vector3.Lerp(a.headPosition, b.headPosition, t),
         headRotation = Quaternion.Slerp(a.headRotation, b.headRotation, t),
         handLeftPosition = Vector3.Lerp(a.handLeftPosition, b.handLeftPosition, t),
         handLeftRotation = Quaternion.Slerp(a.handLeftRotation, b.handLeftRotation, t),
         handRightPosition = Vector3.Lerp(a.handRightPosition, b.handRightPosition, t),
         handRightRotation = Quaternion.Slerp(a.handRightRotation, b.handRightRotation, t),
         voiceAmplitude = Mathf.Lerp(a.voiceAmplitude, b.voiceAmplitude, t),
         controllerLeftPose = ControllerPose.Interpolate(a.controllerLeftPose, b.controllerLeftPose, t),
         controllerRightPose = ControllerPose.Interpolate(a.controllerRightPose, b.controllerRightPose, t),
     });
 }
Exemplo n.º 6
0
    void CollectInput(ref HandPose hand, ref ControllerPose controller, ref HandInput i)
    {
        i.handTrigger          = hand.gripFlex;
        i.previousIndexTrigger = i.indexTrigger;
        i.indexTrigger         = hand.indexFlex;

        if (i.indexTrigger >= IndexThreshold && i.previousIndexTrigger < IndexThreshold)
        {
            i.indexPressFrame = context.renderFrame;
        }

        i.isPointing  = true;
        i.isPressingX = controller.button1IsDown;
        i.isPressingY = controller.button2IsDown;
        i.stick       = controller.joystickPosition;
    }
 public static Pose Interpolate(Pose from, Pose to, float time)
 {
     return(new Pose {
         headPosition = Vector3.Lerp(from.headPosition, to.headPosition, time),
         headRotation = Quaternion.Slerp(from.headRotation, to.headRotation, time),
         handLeftPosition = Vector3.Lerp(from.handLeftPosition, to.handLeftPosition, time),
         handLeftRotation = Quaternion.Slerp(from.handLeftRotation, to.handLeftRotation, time),
         handRightPosition = Vector3.Lerp(from.handRightPosition, to.handRightPosition, time),
         handRightRotation = Quaternion.Slerp(from.handRightRotation, to.handRightRotation, time),
         voiceAmplitude = Mathf.Lerp(from.voiceAmplitude, to.voiceAmplitude, time),
         controllerLeftPose = ControllerPose.Interpolate(from.controllerLeftPose, to.controllerLeftPose, time),
         controllerRightPose = ControllerPose.Interpolate(from.controllerRightPose, to.controllerRightPose, time),
         handLeftPose = HandPose.Interpolate(from.handLeftPose, to.handLeftPose, time),
         handRightPose = HandPose.Interpolate(from.handRightPose, to.handRightPose, time),
     });
 }