Vector2 input = joystick.input;
Transform sphere = sphereObject;
float rotateSpeed = 10;
var euler = sphere.eulerAngles;
euler.x += input.x * rotateSpeed;
euler.z += input.y * rotateSpeed;
sphere.eulerAngles = euler;
[SerializeField] private Queue<GameObject> points;
public Vector2 GetTargetPosition()
{
if (points.Count == 0)
{
//destroy;
}
var point = points.Dequeue();
return point.transform.position;
}
public class Laser : MonoBehaviour
{
[SerializeField] private LineRenderer lineRenderer;
private void Update()
{
//Ray ray = new Ray(origin,direction);
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
if (Physics.Raycast(ray, out hit))
{
lineRenderer.enabled = true;
var firstPosition = Camera.main.transform.position;
var secondPosition = hit.point;
lineRenderer.SetPosition(0, firstPosition);
lineRenderer.SetPosition(1, secondPosition);
}
else
{
lineRenderer.enabled = false;
}
}
}