HeavenStudioPlus/Assets/Scripts/Common/FollowMouse.cs

17 lines
417 B
C#
Raw Normal View History

2022-01-09 23:35:55 +00:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace RhythmHeavenMania.Common
{
public class FollowMouse : MonoBehaviour
{
2022-01-11 00:17:29 +00:00
public Vector2 offset;
2022-01-09 23:35:55 +00:00
private void Update()
{
var pos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
2022-01-11 00:17:29 +00:00
transform.position = new Vector3(pos.x - offset.x, pos.y - offset.y, 0);
2022-01-09 23:35:55 +00:00
}
}
}