stop spinning when moving

Hi, im trying to get an object to move around my screen without rotating, every tutorial ive been on and the ones that come with unity all make them rotate to go left or right.

how would i make it go up if i pressed the up arrow and down if i pressed the down and left or right on the left or right buttons?

Please include more information on what your trying to achieve, do you want a controllable character?
And if you have any code please add it to help give us more understanding.

sorry,

what im trying to do is make a ship (character) move around in the middle of the screen like the old arcade games where it moves up, down, left and right and diagonal if 2 are held together.

i havnt got any code atm (apart from the 3rd person character controller that comes with unity) as none ive tried do what im wanting them to do.

Untested…

  transform.position = transform.forward * Input.GetAxis ("Vertical");
  transform.position = transform.right * Input.GetAxis ("Horizontal");

hmm, that makes it move in the direction its moving, i’ll try explain better.

i have a spaceship thats constantly spinning with this code. transform.Rotate(Vector3.up * Time.deltaTime*80);

is there a way to make the parent object, no matter where it is facing, when i press say, W to go north (even though its facing south) instead of going forward what ever way it is facing?

or will i have to do this with the animations making it spin?

Yes, the transform.Translate method takes in a Spacing argument. Set that to Spacing.World, and that should do it, unless you’re trying something else.

Sorry, when you said:

I was thinking of space invaders where the ship always points up.

Try this:

 transform.position = Vector3.up * Input.GetAxis ("Vertical");
 transform.position = Vector3.right * Input.GetAxis ("Horizontal");

That should work, but makes certain assumptions camera position etc. If Vector3.up for example doesn’t move the ship in the right direction, try Vector3.forward etc.

http://unity3d.com/support/documentation/ScriptReference/Vector3.html

thanks guys, used

 if(Input.GetButton("Up"))
{
	 transform.Translate(Vector3.forward * Time.deltaTime*speed, Space.World);
}

and it works perfectly.