- Home /
[HELP] Rotate Bullet Script
Hello there, I have been trying to figure out a script to make bullets rotate , for some reason it says I have 50 error's but it says i have none? here is he script. Thank's for the help!
function Start () { transform.Rotate(new Vector3(0, Random.Range(-180.0, 180.0), 0)); }
this is hard to understand. are you trying to make a bullet 'spin' while it it travelling , or are you trying to create a random 'spread' so your bullets don't go to the same point when not moving?
transform.Rotate works by rotating a gameObject over Time , which needs to be in an update loop to keep 'spinning'
transform.rotation would be more to instantiate a bullet with a random rotation angle to travel from/to.
transform.Rotate :
http://unity3d.com/support/documentation/ScriptReference/Transform.Rotate.html
function Update()
{
transform.Rotate(transform.forward * Time.deltaTime);
}
transform.rotation :
http://unity3d.com/support/documentation/ScriptReference/Transform-rotation.html
Instantiate Random.rotation :
http://unity3d.com/support/documentation/ScriptReference/Random-rotation.html