Answers for "unity object follow mouse"

0

unity object follow mouse

if (Input.GetMouseButton(1)) {
            mousePosition = Input.mousePosition;
            mousePosition = Camera.main.ScreenToWorldPoint(mousePosition);
            transform.position = Vector2.Lerp(transform.position, mousePosition, moveSpeed);
        }
Posted by: Guest on April-20-2021

Browse Popular Code Answers by Language