Move
Keyboard a move left keyboard D to the right to move the keyboard W move forward the keyboard s backward
Adws is the y-axis unchanged, move up or down
The move is the value assigned to which axis is moved, and the rotation is the axis to which the axis is assigned.
float h= input.getaxis ("horizontal") *time.deltatime*speed;
Float V=input.getaxis ("Vertical") *time.deltatime*speed;
Transform. Translate (H,0,V);
Lens to the left turn Q lens rotate Right E
if (Input.getkey (KEYCODE.Q))
{
Rotate along the y axis, i.e. rotate left and right
Transform. Rotate (0,-25*time.deltatime,0,space.self);
}
if (Input.getkey (KEYCODE.E))
{
Transform. Rotate (0,25*time.deltatime,0,space.self);
}
Lens up H lens down n
if (Input.getkey (KeyCode.H))
{
Transform. Translate (0,time.deltatime*speed,0);
}
if (Input.getkey (KEYCODE.N))
{
Transform. Translate (0,-time.deltatime*speed,0);
}
Lens up rotation z lens rotate down C
if (Input.getkey (KEYCODE.Z))
{
Rotate along the x axis
Transform. Rotate ( -25*time.deltatime,0,0,space.self);
}
if (Input.getkey (keycode.c))
{
Transform. Rotate (25*time.deltatime,0,0,space.self);
}
That is, from the previous and the left and right move, more up and down move
From the previous rotation around, more and more up and down rotation
unity3d-keyboard control for visual rotation and movement