unity face direction of movement
transform.rotation = Quaternion.LookRotation(dir);
3.7
10
float moveHorizontal = Input.GetAxisRaw ("Horizontal"); float moveVertical = Input.GetAxisRaw ("Vertical"); Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical); transform.rotation = Quaternion.LookRotation(movement); transform.Translate (movement * movementSpeed * Time.deltaTime, Space.World);
Thank you!
10
0
Are there any code examples left?
New code examples in category C#