Hi. I’m new to Unity. How can I create movement and control for example a spaceship?
Please read: CharacterController
Basically you should give your spaceship a CharacterController Component (Menu Component → Physics → Character Controller).
Then create a new Script which you add to the spaceship as well.
An example script in C#:
public class Mover : MonoBehaviour {
public int moveSpeed = 100;
private CharacterController controller;
void Start () { controller = GetComponent<CharacterController>(); }
// Update is called once per frame
void Update () {
float horizontal = Input.GetAxis("Horizontal");
float vertical = Input.GetAxis("Vertical");
Vector3 move = horizontal * Vector3.right + vertical * Vector3.forward;
if(move.sqrMagnitude > 1)
move.Normalize();
move *= Time.deltaTime * moveSpeed;
controller.SimpleMove(move);
}
}
Hope it helps.
is it some more I have to do?