#Need help with Input system mouse delta

1 messages · Page 1 of 1 (latest)

pine narwhal
#
            else
            {
                Camera.main.orthographicSize -= 100 * Time.deltaTime;
            }

            Camera.main.orthographicSize = Mathf.Clamp(Camera.main.orthographicSize, zoomLevelMin, zoomLevelMax);

            var normalizedSize = Mathf.Clamp(Camera.main.orthographicSize, zoomLevelMin, zoomLevelMax);
            var percentage = (normalizedSize - zoomLevelMin) / (zoomLevelMax - zoomLevelMin);

            var positionMax = new Vector3(0f, 15f, 0f);
            var rotationMax = new Vector3(90f, 0f, 0f);
            var positionMin = new Vector3(0f, 15f, -14.75f);
            var rotationMin = new Vector3(45f, 0f, 0f);

            if (normalizedSize >= zoomLevelLerp)
            {
                this.transform.localPosition = positionMax;
                this.transform.localRotation = Quaternion.Euler(rotationMax);
            }
            else
            {
                var percentageLerp = Mathf.Clamp01((normalizedSize - zoomLevelMin) / (zoomLevelLerp - zoomLevelMin));

                this.transform.localPosition = Vector3.Lerp(positionMin, positionMax, percentageLerp);
                this.transform.localRotation = Quaternion.Lerp(Quaternion.Euler(rotationMin), Quaternion.Euler(rotationMax), percentageLerp);
            }
        }

        private Vector2 lastMousePosition;
        private bool isMapPositioning;
        private void SetPosition(float value)
        {
            var currentMousePosition = Mouse.current.position.ReadValue();
            this.lastMousePosition = currentMousePosition;

            if (value == 1)
            {
                this.isMapPositioning = true;
            }
            else if (value == 0)
            {
                this.isMapPositioning = false;
            }
        }
    }
}
#

For the input system i've assigned <Mouse>/scroll as Value Delta

#

So the code is working as it does scrolling and zooms in and out but there is some weird behaviour where the mouse suddenly jumps position

and for both position and mousewheel, when i build the project it is way more sensitive than with the editor

could use some pointers here, thanks

inland salmon
#

Why do you multiply by time delta time