Movement and Mouselook Flashcards
How do you deal with Unity speeding up at higher FPSs?
Use Time.deltaTime and multiply that by the movement speed.
Describe a left-handed coordinate system.
X-axis goes left to right.Y-axis goes down to up.Z-axis goes from out of the screen to into the screen.
How do you limit numbers or vectors to a certain value?
By clamping them.Mathf.Clamp()Vector3.Clamp()
How do you make a component required?
[RequireComponent (typeof(component))]
How do you add a script to the component menu?
[AddComponentMenu(“menu/name”)]
How do you stop the game world affecting the character’s rotation?
GetComponent(RigidBody)freezeRotation = true
How do you make a character move?
Get input using Input.GetAxis(“Horizontal”) and Input.GetAxis(“Vertical”) and GetComponent().Move(Vector3) but use transform.TransformDirection(Vector3) on the vector first so it uses local axes.
How do you get the mouse movement info?
Input.GetAxis(“Mouse X”)Input.GetAxis(“Mouse Y”)Returns float value from -1 to 1.