コード例 #1
0
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            if (!VRSF_Components.SetupVRIsReady)
            {
                return(inputDeps);
            }

            NativeArray <float3> rotationAxisOutput = new NativeArray <float3>(1, Allocator.TempJob);
            NativeArray <float>  currentSpeedOutput = new NativeArray <float>(1, Allocator.TempJob);

            var job = new DecelerationJob
            {
                DeltaTime    = Time.deltaTime,
                RotationAxis = rotationAxisOutput,
                CurrentSpeed = currentSpeedOutput
            }.Schedule(this, inputDeps);

            job.Complete();

            VRSF_Components.RotateVRCameraAround(rotationAxisOutput[0], currentSpeedOutput[0]);

            rotationAxisOutput.Dispose();
            currentSpeedOutput.Dispose();

            return(inputDeps);
        }
コード例 #2
0
        protected override void OnUpdate()
        {
            if (!VRSF_Components.SetupVRIsReady)
            {
                return;
            }

            Entities.ForEach((ref NonLinearUserRotation nlur, ref ControllersInteractionType cit, ref BaseInputCapture bic, ref TouchpadInputCapture tic) =>
            {
                if (!nlur.HasAlreadyRotated && InteractionChecker.IsInteracting(bic, cit) && math.abs(tic.ThumbPosition.x) > 0.5f)
                {
                    VRSF_Components.RotateVRCameraAround(new float3(0.0f, tic.ThumbPosition.x, 0.0f), nlur.DegreesToRotate);
                    nlur.HasAlreadyRotated = true;
                }
                else if (nlur.HasAlreadyRotated && math.abs(tic.ThumbPosition.x) < 0.5f)
                {
                    nlur.HasAlreadyRotated = false;
                }
            });
        }