This commit is contained in:
2026-01-23 12:59:14 +00:00
parent 9432d2d776
commit 3c08b15c9e
6 changed files with 107 additions and 11 deletions

View File

@@ -2,22 +2,22 @@ using UnityEngine;
public class FakeCursor : MonoBehaviour
{
public RectTransform RectBounds;
public Camera AttachedCamera;
private void Start()
{
Cursor.visible = false;
//Cursor.visible = false;
}
private void Update()
{
Vector3 absolutePosition = new()
{
x = Input.mousePosition.x / Screen.width * 1920,
y = Input.mousePosition.y / Screen.height * 1080,
z = 5f
};
transform.position = AttachedCamera.ScreenToWorldPoint(absolutePosition);
Vector2 size = new(Screen.width, Screen.height);
Vector2 hSize = new Vector2(AttachedCamera.pixelRect.width, AttachedCamera.pixelRect.height) / 2f;
Debug.Log(hSize);
Vector2 positionRelativeToMiddle = (size - hSize) + (Vector2)Input.mousePosition;
transform.position = AttachedCamera.ScreenToWorldPoint(new Vector3(positionRelativeToMiddle.x, positionRelativeToMiddle.y, 5f));
}
private void OnDestroy()