Movement based on direction of an object.

Hey guys, could I have a code snippet on how to move a object based on wheres its facing (z axis) and to move forward.

This is my closest thing :

rb.velocity = new Vector3 (0,0,1);

however, it doesent care about where its facing.

Thanks unity buddys!

That will always move the object forward on a global scale. Try using transform.forward to get the forward direction of the object.

how would i implement this into my code?

Take a look at the documentation I provided. It tells you it is a vector3, so replace your current vector3 with it.