[TASK] Initial commit with basic product setup
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
namespace Mapbox.Examples
|
||||
{
|
||||
using UnityEngine;
|
||||
|
||||
namespace Scripts.Utilities
|
||||
{
|
||||
public class DragRotate : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
Transform _objectToRotate;
|
||||
|
||||
[SerializeField]
|
||||
float _multiplier;
|
||||
|
||||
Vector3 _startTouchPosition;
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (Input.GetMouseButtonDown(0))
|
||||
{
|
||||
_startTouchPosition = Input.mousePosition;
|
||||
}
|
||||
|
||||
if (Input.GetMouseButton(0))
|
||||
{
|
||||
var dragDelta = Input.mousePosition - _startTouchPosition;
|
||||
var axis = new Vector3(0f, -dragDelta.x * _multiplier, 0f);
|
||||
_objectToRotate.RotateAround(_objectToRotate.position, axis, _multiplier);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user