Example #1
0
 public void Update()
 {
     if (Time.frameCount != preFrame)
     {
         preFrame            = Time.frameCount;
         preControllerStates = controllerStates;
         if (NoloVR_Playform.GetInstance().GetPlayformError() == NoloError.None && NoloVR_Playform.GetInstance().GetAuthentication())
         {
             controllerStates = NoloVR_Plugins.GetControllerStates(index);
             if (isTurnAround)
             {
                 if (NoloVR_Controller.recPosition == Vector3.zero)
                 {
                     NoloVR_Controller.recPosition = NoloVR_Plugins.GetPose(0).pos;
                 }
                 pose = NoloVR_Plugins.GetPose(index);
                 var rot = pose.rot.eulerAngles;
                 rot               += new Vector3(0, 180, 0);
                 pose.rot           = Quaternion.Euler(rot);
                 pose.pos.x         = NoloVR_Controller.recPosition.x * 2 - pose.pos.x;
                 pose.pos.z         = NoloVR_Controller.recPosition.z * 2 - pose.pos.z;
                 pose.vecVelocity.x = -pose.vecVelocity.x;
                 pose.vecVelocity.z = -pose.vecVelocity.z;
                 return;
             }
             NoloVR_Controller.recPosition = Vector3.zero;
             pose = NoloVR_Plugins.GetPose(index);
         }
     }
 }
Example #2
0
        public void Update()
        {
            if (Time.frameCount != preFrame)
            {
                preFrame            = Time.frameCount;
                preControllerStates = controllerStates;
                if (NoloVR_Playform.InitPlayform().GetPlayformError() == NoloError.None)
                {
                    controllerStates = NoloVR_Plugins.GetControllerStates(index);
                    trackingStatus   = NoloVR_Plugins.GetTrackingStatus(index);
                    if (isTurnAround)
                    {
                        if (NoloVR_Controller.recPosition == Vector3.zero)
                        {
                            NoloVR_Controller.recPosition = NoloVR_Plugins.GetPose(0).pos;
                        }
                        pose = NoloVR_Plugins.GetPose(index);
                        //pose.rot *= new Quaternion(0, 1, 0, 0);
                        Vector3 rot = pose.rot.eulerAngles;
                        rot       += new Vector3(0, 180, 0);
                        pose.rot   = Quaternion.Euler(rot);
                        pose.pos.x = NoloVR_Controller.recPosition.x * 2 - pose.pos.x;
                        pose.pos.z = NoloVR_Controller.recPosition.z * 2 - pose.pos.z;

                        return;
                    }
                    NoloVR_Controller.recPosition = Vector3.zero;
                    pose = NoloVR_Plugins.GetPose(index);
                }
            }
        }
Example #3
0
        public static NoloVR_Plugins.Nolo_ControllerStates GetControllerStatesByDeviceType(int deviceIndex)
        {
            NoloVR_Plugins.Nolo_ControllerStates result = new NoloVR_Plugins.Nolo_ControllerStates();
            Nolo_ControllerStates state = get_Nolo_ControllerStates(deviceIndex);

            result.buttons        = state.buttons;
            result.touches        = state.touches;
            result.touchpadAxis.x = state.touchpadAxis.x;
            result.touchpadAxis.y = state.touchpadAxis.y;
            return(result);
        }