Space Shooter tutorial 'bolt' script

I am new to Unity and am running through the Space Shooter tutorial. I have manage to follow it OK up to step 6, I am now having trouble getting the laser ‘bolt’ to move as the script commands seem to be different.

This is the script used in the original video:

public class Mover : MonoBehaviour
{
public float speed;
void Start ()
{
rigidbody.velocity = transform.forward * speed;
}
}

I have looked at the document that details the changed for Unity 5.x and this is what I now have:

public class Mover : MonoBehaviour
{

public Rigidbody rb;
void Start()
{
rb = GetComponent();
rb.velocity =
}
}

I dont understand how I set the speed with this new script? With the old script the speed option will appear inside the project. The document does not say what to put after rb.velocity =.

you change the line rigidbody.velocity to rb.velocity, it’s simple

Thats great cheers the script now works and ‘speed’ appears in my project. However I am wondering something else now, regarding this: ‘rb.velocity = transform.forward * speed;’ the bolt travel along the blue axis, how can I make it travel along the green axis?

You mean the y axis? Change transform.forward to transform.up, but this should be easy, go watch more tutorials

Thank you :slight_smile: I will watch other tutorials, this is the first one I decided to try.