Character faces direction but then input moves character relative to the position character is facing
This commit is contained in:
@@ -31,7 +31,9 @@ public class PlayerController : MonoBehaviour
|
|||||||
moveDirection = (transform.forward * Input.GetAxisRaw("Vertical")) + (transform.right * Input.GetAxisRaw("Horizontal"));
|
moveDirection = (transform.forward * Input.GetAxisRaw("Vertical")) + (transform.right * Input.GetAxisRaw("Horizontal"));
|
||||||
|
|
||||||
//Player rotation
|
//Player rotation
|
||||||
transform.Rotate(0, Input.GetAxis("Horizontal") * Time.deltaTime * rotationSpeed, 0);
|
//transform.Rotate(0, Input.GetAxis("Horizontal") * Time.deltaTime * rotationSpeed, 0);
|
||||||
|
Vector3 newPosition = new Vector3(Input.GetAxis("Horizontal"), 0.0f, Input.GetAxis("Vertical"));
|
||||||
|
transform.LookAt(newPosition + transform.position);
|
||||||
|
|
||||||
if (extraJump == true)
|
if (extraJump == true)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user