Hi guys.
I have just started scripting in C#, so i,m a real noob, and I am trying to create a FPS 1st Person Controller, and this is what I have so far…
using UnityEngine;
using System.Collections;
public class FPS_Controller : MonoBehaviour {
public float walkingSpeed = 3.2f;
public float runningSpeed = 10f;
public float crouchSpeed = 2f;
public float strafeSpeed = 5f;
public float rotationSpeed = 40f;
public float lookSpeed = 50f;
void Start () {
bool isCrouched = false;
bool isRunning = false;
bool isLooking = false;
}
void Update ()
{
float translation = Input.GetAxis ("Vertical") * runningSpeed * Time.deltaTime;
float strafe = Input.GetAxis ("Horizontal") * strafeSpeed * Time.deltaTime;
float rotation = rotationSpeed * Input.GetAxis ("Mouse X") * Time.deltaTime;
transform.Translate(0, 0, translation);
transform.Translate(strafe, 0, 0);
transform.Rotate(0, rotation, 0);
}
}
Now, the question is, is this ok or should I be using Quaternion’s or Euler angles, and what am I using now?
Thanks