Hi,
I am trying to make mini golf game. So far I’ve created scenes and ball. Also i made script for rotating camera. I am stuck on shooting ball script. This is my script for shooting ball.
using UnityEngine;
public class Pucanje : MonoBehaviour
{
public float thrust = 1000;
private GameObject ball;
void Start()
{
ball = GameObject.Find("Sphere");
}
void Update()
{
if (Input.GetMouseButton(0))
ball.GetComponent<Rigidbody>().AddForce(Camera.main.transform.forward * thrust);
}
}
But this script does nothing. Can you tell me what is wrong? Am I on right track at least?
thank you in advance.