コード例 #1
0
        protected virtual void Update()
        {
            inputManager.Update(key);

            // Calculate delta
            if (requires == null || requires.gameObject.activeInHierarchy == true || Input.GetMouseButton(1) == true)
            {
                if (Application.isPlaying == true)
                {
                    var delta = inputManager.GetAverageDeltaScaled();

                    pitch -= delta.y * pitchSensitivity;
                    yaw   += delta.x * yawSensitivity;
                }
            }

            pitch = Mathf.Clamp(pitch, pitchMin, pitchMax);

            // Smoothly dampen values
            var factor = P3dHelper.DampenFactor(dampening, Time.deltaTime);

            currentPitch = Mathf.Lerp(currentPitch, pitch, factor);
            currentYaw   = Mathf.Lerp(currentYaw, yaw, factor);

            // Apply new rotation
            transform.localRotation = Quaternion.Euler(currentPitch, currentYaw, 0.0f);
        }
コード例 #2
0
        protected virtual void Update()
        {
            inputManager.Update(key);

            if (target != null)
            {
                if (Pressing() == true)
                {
                    if (storeStates == true && target.enabled == false)
                    {
                        P3dStateManager.StoreAllStates();
                    }

                    target.enabled = true;
                }
                else
                {
                    target.enabled = false;
                }
            }
        }
コード例 #3
0
        protected virtual void Update()
        {
            inputManager.Update(key);

            // Calculate delta
            if (CanRotate == true && Application.isPlaying == true)
            {
                var delta = inputManager.GetAverageDeltaScaled(true);

                pitch -= delta.y * pitchSensitivity;
                yaw   += delta.x * yawSensitivity;
            }

            pitch = Mathf.Clamp(pitch, pitchMin, pitchMax);

            // Smoothly dampen values
            var factor = P3dHelper.DampenFactor(dampening, Time.deltaTime);

            currentPitch = Mathf.Lerp(currentPitch, pitch, factor);
            currentYaw   = Mathf.Lerp(currentYaw, yaw, factor);

            // Apply new rotation
            transform.localRotation = Quaternion.Euler(currentPitch, currentYaw, 0.0f);
        }