Rotate Object As it Follows Path

I have a rocket that orbits a planet, but I am having a difficult time making the rocket turn as it moves. I have done research and looked through some unity docs, but haven’t been able to make it work. Here’s a video of my issue - - YouTube

Here’s my code:

using UnityEngine;
using System.Collections;

public class RocketOrbit : MonoBehaviour {

	public Transform target;
	//float rotSpeed=180f;
	float speed = 2f;
	float timeCounter = 0;
	int orbitCounter = 0;
	//private bool moving;
	//private Rigidbody2D myRigidBody;

	// Use this for initialization
	void Start () {
	
		//myRigidBody = GetComponent<Rigidbody2D> ();
	}
	
	// Update is called once per frame
	void Update () {
		
		RocketMove ();

		//Attempt 1

		/*var targetDir = target.position - transform.position;
		var step = speed * Time.deltaTime;
		var newDir = Vector3.RotateTowards (transform.forward, targetDir, step, 0.0f);
		Debug.DrawRay (transform.position, newDir, Color.blue);
		transform.rotation = Quaternion.LookRotation (newDir);*/

		//Attempt 2

		/*Quaternion rot = transform.rotation;

		float z = rot.eulerAngles.z;

		z -= Input.GetAxis ("Horizontal") * rotSpeed * Time.deltaTime;

		rot = Quaternion.Euler (0, 0, z);

		transform.rotation = rot;

		Vector3 shipPos = transform.position;

		Vector3 velocity = new Vector3 (0, Input.GetAxis ("Vertical") * speed * Time.deltaTime, 0);

		shipPos += rot * velocity;

		transform.position = shipPos;*/

		if (orbitCounter == 5) {

			Destroy (gameObject);

		}
	}

	public void OnTriggerEnter2D(Collider2D  other){

		if (other.tag == "Orbit Collider") {

			orbitCounter++;
			Debug.Log (orbitCounter);

		}

	}

	public void RocketMove(){

		//moving = true;

		timeCounter += Time.deltaTime;

		float x = Mathf.Cos (timeCounter)*2;
		float y = Mathf.Sin (timeCounter)*2;
		float z = 0;

		transform.position = new Vector3 (x, y, z);

	}
}

you might give Transform.LookAt a try. It makes an object face a specific point in space. Usually you would just use the velocity vector of the rigidbody but since you change the position via transform.position that won´t work. My suggestion would be that you chose a future position of your rocket as a target for the LookAt function. Pretty much your calculation of the new transform,position with a slight increase of the timeCounter.

         float x_2 = Mathf.Cos (timeCounter + Time.deltaTime) *2;
         float y_2 = Mathf.Sin (timeCounter + Time.deltaTime)*2;
         float z_2 = 0;

         Vector3 futurePosition = new Vector3 (x_2, y_2, z_2);
 
         transform.LookAt(futurePosition);

It might even work to just smuggle the LookAt in right before setting a new transform,position. Kinda like making the rocket look at the position it´s gonna jump to in the next line of code.

     public void RocketMove(){
 
         //moving = true;
 
         timeCounter += Time.deltaTime;
 
         float x = Mathf.Cos (timeCounter)*2;
         float y = Mathf.Sin (timeCounter)*2;
         float z = 0;
         transform.LookAt(new Vector3 (x, y, z));
         transform.position = new Vector3 (x, y, z);
 
     }

good luck (: