Hi there guys
I need to rotate my “ball” game object in a to a random amount before the force is added. Can someone tell me why this is not working?
if(gameState == "power")
{
if(barDisplay < 1.8)
{
barDisplay += Time.deltaTime * 0.7;
}
else
{
curHoleShots +=1;
GameObject.FindWithTag("ball").GetComponent("Score").totalShots +=1;
lastShotPosition = ball.transform.position;
ball.transform.rotation.y += Random.Range(1,100);
ball.rigidbody.AddForce(transform.forward * 25);
gameState = "aim";
barDisplay = 0;
}
}