Unity

Miscellaneous Forums/General Discussion/Unity

The rotation speed hasn't been decided yet - at the moment its rather slow, so will need changing.

For those interested, the only code present is this (to control the craft ) :

var turnSpeed=40.0;
var thrust=0.0;

function Start()
{
	thrust=0.0;
	transform.Translate(0.0,0.0,0.0);
}

function FixedUpdate()
{
var bank=0.0;
var tilt=0.0;
	
	bank=Input.GetAxis("Mouse Y")*Time.deltaTime*turnSpeed*-1.0; 
	tilt=Input.GetAxis("Mouse X")*Time.deltaTime*turnSpeed*-1.0;	
	
	if (Input.GetButton("Fire1"))
	{
		thrust+=Time.deltaTime*25.0;
		if (thrust>5.0)
		{
			//thrust=5.0;
		}
	}
	else
	{
		thrust-=Time.deltaTime*25.0;
		if (thrust<0.0)
		{
			thrust=0.0;
		}
	}

	transform.Rotate(bank,0.0,tilt);
	rigidbody.AddForce(thrust*transform.up);
}


All the animation and physics is handled by Unity, and not by me.