Rigidbody2D Flight

Hello all,

Been working on this little project with a Rigidbody2D rocket, however, the flight of the rocket is not working quite how I would like it to. I would like the rocket to always move in the direction it is facing, like a jet. As it is now, it kind of Tokyo drifts round corners. This video maybe explains it better:

If anyone could shed some light on how to code this I would be most grateful!

Also see images for what I am trying to achieve.

Many thanks in advance!

	public float velocity;
	public float leftRotationSpeed;
	public float rightRotationSpeed;
	


	void FixedUpdate() 

	{
		if (Input.GetKey (KeyCode.UpArrow)) 
		{
			GetComponent<Rigidbody2D>().AddForce(transform.up * velocity);
		}	

		if (Input.GetKey (KeyCode.DownArrow)) 
		{
			GetComponent<Rigidbody2D>().AddForce(transform.up * -velocity);
		}	


		if (Input.GetKey (KeyCode.LeftArrow)) 
		{
			GetComponent<Rigidbody2D>().AddTorque(Input.GetAxis ("Horizontal") * leftRotationSpeed);
		}

		if (Input.GetKey (KeyCode.RightArrow)) 
		{
			GetComponent<Rigidbody2D>().AddTorque(Input.GetAxis ("Horizontal") * rightRotationSpeed);
		}

	}

}![58457-rocket2.jpg|720x480](upload://n6jVHgn6tZcoHxgJm3FOyTydwjo.jpeg)

Rather than adding torque, it sounds like you should just rotate the object. That will make the rotation instant rather than slowly building force.

Also, you should store the Rigidbody2D in a variable rather than calling GetComponent() every FixedUpdate(). Repeated calls to GetComponent are very expensive and will likely cause performance issues down the line.

Thanks @Dinosaurs! Though I do quite like the slight physics lag you get with torque. Do you think I can achieve the same effect with .MoveRotation?