How can I set how fast a ship turns with rotation? say maybe degrees per sec or something? Heres the current code…
using UnityEngine;
using System.Collections;
public class ShipControl : MonoBehaviour
{
public Transform ship;
float flyingSpeed = 0;
float turnSpeed = 50.0f;
void Update ()
{
//Accelerate the ship using the thrust key.
if(Input.GetKeyDown("e"))
{
if(flyingSpeed == 0)
{
flyingSpeed = 2.5f;
}
else if(flyingSpeed == 2.5f)
{
flyingSpeed = 5f;
}
else if(flyingSpeed == 5f)
{
flyingSpeed = 7.5f;
}
else if(flyingSpeed == 7.5f)
{
flyingSpeed = 10f;
}
}
//Decelerate the ship using the thrust button.
if(Input.GetKeyDown("q"))
{
if(flyingSpeed == 10f)
{
flyingSpeed = 7.5f;
}
else if(flyingSpeed == 7.5f)
{
flyingSpeed = 5f;
}
else if(flyingSpeed == 5f)
{
flyingSpeed = 2.5f;
}
else if(flyingSpeed == 2.5f)
{
flyingSpeed = 0;
}
else
{
flyingSpeed = 0;
}
}
if(Input.GetKey("w"))
{
ship.transform.Rotate(20.0f * Time.deltaTime, 0.0f, 0.0f);
}
if(Input.GetKey("s"))
{
ship.transform.Rotate(-20.0f * Time.deltaTime, 0.0f, 0.0f);
}
if(Input.GetKey("d"))
{
ship.transform.Rotate(0.0f, turnSpeed * Time.deltaTime, 0.0f * Time.deltaTime, Space.World); //and then turn the plane
}
if(Input.GetKey("a"))
{
ship.transform.Rotate(0.0f, -turnSpeed * Time.deltaTime, 0.0f * Time.deltaTime, Space.World); //and then turn the plane
}
ship.transform.Translate(0,-flyingSpeed * Time.deltaTime,0);//move the ship
}
}