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);
It’s nice to see that mgrekt will just say to use code tags and then don’t contribute to helping the solution. Though yes, you should use code tags and could work on your spelling and grammar. Either way, Time.timeScale should affect the way time works in your game. Instead of using it the way they are, add it into a few of your if statements to where you want the time to be slowed. You can find a previous forum article here: Slowing Down Time and will find the Unity document here: Unity - Scripting API: Time.timeScale