tmp
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user