Scripts is C# please
Okay so I need someone to write a script that when you left click, the gameobject that the script is attached to is launched forward. If you could add is a few variables that controlled the speed that would be great. I am sorry if this is a bit passive agressive, but I have tried and tried to find a tutorial that actually does what I want it.
Here is the script that I have so far (ignore the first part that is to make sure the bullet starts where I want it to):
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class gunController : MonoBehaviour {
public Transform father;
void Start () {
father = transform.parent;
transform.position = father.position;
}
void Update () {
if (Input.GetMouseButtonDown(0)
{
}
}
}