Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void FixedUpdate ()
- {
- float moveHorizontal = Mathf.Cos(cam.transform.rotation.eulerAngles.y * Mathf.Deg2Rad) *Input.GetAxis("Horizontal") + Mathf.Sin(cam.transform.rotation.eulerAngles.y * Mathf.Deg2Rad) * Input.GetAxis("Vertical");
- float moveVertical = Mathf.Cos(cam.transform.rotation.eulerAngles.y*Mathf.Deg2Rad)*Input.GetAxis("Vertical") - Mathf.Sin(cam.transform.rotation.eulerAngles.y * Mathf.Deg2Rad) * Input.GetAxis("Horizontal");
- Vector3 movement = new Vector3(moveHorizontal, 0.0f,moveVertical);
- Debug.Log(movement);
- rb.AddForce(movement.normalized*speed);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement