Hello everyone im having trouble with the gameplay i have the script working but when you drag to shoot player forwards its too fast and i was wandering how to slow down the gameplay when dragging and shooting here’s my script. thx
using UnityEngine;
public class ShootBall : MonoBehaviour
{
private LineRenderer _lineRenderer;
public void Start()
{
_lineRenderer = gameObject.AddComponent();
_lineRenderer.SetWidth(0.2f, 0.2f);
_lineRenderer.enabled = false;
}
}
else if (Input.GetMouseButtonUp(0))
{
_lineRenderer.enabled = false;
var releasePosition = GetCurrentMousePosition().GetValueOrDefault();
var direction = releasePosition - _initialPosition;
Debug.Log("Process direction " + direction);
}
}
private Vector3? GetCurrentMousePosition()
{
var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
var plane = new Plane(Vector3.forward, Vector3.zero);
float rayDistance;
if (plane.Raycast(ray, out rayDistance))
{
return ray.GetPoint(rayDistance);