Batch 1 - Scripts
This commit is contained in:
25
Assets/New Lowpoly Models/Scripts/CamerasTouchArea.cs
Normal file
25
Assets/New Lowpoly Models/Scripts/CamerasTouchArea.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
public class CameraTouchArea : MonoBehaviour, IPointerDownHandler, IDragHandler
|
||||
{
|
||||
public static Vector2 LookDelta;
|
||||
|
||||
private Vector2 lastPosition;
|
||||
|
||||
public void OnPointerDown(PointerEventData eventData)
|
||||
{
|
||||
lastPosition = eventData.position;
|
||||
}
|
||||
|
||||
public void OnDrag(PointerEventData eventData)
|
||||
{
|
||||
LookDelta = eventData.position - lastPosition;
|
||||
lastPosition = eventData.position;
|
||||
}
|
||||
|
||||
private void LateUpdate()
|
||||
{
|
||||
LookDelta = Vector2.zero;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user