Ship code speed not changing?

Hi,

I’m using this code to control a ship. The controls are fine, however no matter how big I make the speed variable, the ship always moves extremely slowly. Why could this be happening?

var speed : float = 900;

var smooth = 2.0;
var tiltAngle = 10.0;

var rotationx=0;
var rotationy=0;
var rotationz=0;
var positionx: float=0.0;
var positiony: float=0.0;
var positionz: float=0.0;
var uplift:float =0.0;

function Update () {
	
	transform.Rotate(Input.GetAxis("Vertical")*Time.deltaTime*100,0,0);
	
	transform.Rotate(0,Input.GetAxis("Horizontal")*Time.deltaTime*100,0,Space.World);
	
	transform.Rotate(0,0,Input.GetAxis("Horizontal")*Time.deltaTime*50*-1);
	
	if ((Input.GetAxis ("Horizontal")<0)(rotationz >45)(rotationz <90))
	{
		transform.Rotate(0,0,Time.deltaTime*-50);
	}
	
	if ((Input.GetAxis ("Horizontal")>0)(rotationz <315)(rotationz >270))
	{
		 transform.Rotate(0,0,Time.deltaTime*50);
	}
	
	transform.Translate(0,0,speed/20*Time.deltaTime);
	
		rotationx=transform.eulerAngles.x; 
		rotationy=transform.eulerAngles.y; 
		rotationz=transform.eulerAngles.z; 
		positionx=transform.position.x;
		positiony=transform.position.y;
		positionz=transform.position.z;
		
		if ((rotationz >0)  (rotationz < 90)(!Input.GetButton ("Horizontal"))) 
		{
			transform.Rotate(0,0,Time.deltaTime*-50);
		}
		
		if ((rotationz >0)  (rotationz > 270)(!Input.GetButton ("Horizontal"))) 
		{
			transform.Rotate(0,0,Time.deltaTime*50);
		}
		
		if ((rotationz >180)  (rotationz < 270)(!Input.GetButton ("Horizontal"))) 
		{
			transform.Rotate(0,0,Time.deltaTime*-50);
		}
		
		if ((rotationz <180)  (rotationz > 90)(!Input.GetButton ("Horizontal")))
		{
			 transform.Rotate(0,0,Time.deltaTime*50);
		}
		
		rigidbody.AddRelativeForce (Vector3.forward * speed);

First define “var speed: float” like 900.0 not 900
(Also look if you are defining “speed” in the Inspector, because in this case the value in the Inspector has priority).

Then try using only one “movement” instruction at a time to see the difference:

“transform.Translate(0,0,speed/20*Time.deltaTime);”

or

“rigidbody.AddRelativeForce (Vector3.forward * speed);”

That makes zero difference.

That’s true. Also try using something like ForceMode.Acceleration instead of the default, which tends to need quite large values to have any effect.

–Eric