I am attempting to create my own player controller, but what is happening is the movement does not change with the rotation
C#
PlayerMovement.cs
using UnityEngine;
using System;
using System.Collections;
public class PlayerMovement : MonoBehaviour {
public float moveSpeed = 1.0f;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (Input.GetKey (KeyCode.W)) {
transform.position += Vector3.forward * moveSpeed;
}
if (Input.GetKey (KeyCode.S)) {
transform.position += Vector3.back * moveSpeed;
}
if (Input.GetKey (KeyCode.D)) {
transform.position += Vector3.right * moveSpeed;
}
if (Input.GetKey (KeyCode.A)) {
transform.position += Vector3.left * moveSpeed;
}
}
}
MouseLook.cs
using UnityEngine;
using System.Collections;
public class MouseLook : MonoBehaviour {
public float mouseLook = 1.0f;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if(Input.GetKey(KeyCode.LeftArrow)){
transform.Rotate(Vector3.down * mouseLook);
}
if(Input.GetKey(KeyCode.RightArrow)){
transform.Rotate(Vector3. * mouseLook);
}
}
}