This doesn't work. I have no idea...
I get this error a lot:
Assets/Controller3dmodel.cs(16,57): error CS1502: The best overloaded method match for `UnityEngine.Quaternion.Euler(float, float, float)' has some invalid arguments
This is a simple script but it refuses to work:
using UnityEngine;
using System.Collections;
public class Controller : MonoBehaviour {
Rigidbody rb;
public bool pressw;
public Quaternion rotation = Quaternion.identity;
// Use this for initialization
void Start () {
rb = GetComponent();
}
// Update is called once per frame
void Update () {
if (Input.GetKey ("w")) {
rb.AddForce (-10, 0, 0);
transform.eulerAngles = new Vector3(0, 45, 0);
pressw = true;
}
if (Input.GetKey ("s")) {
rb.AddForce(10, 0, 0);
pressw = true;
}
if (Input.GetKey ("a")) {
rb.AddForce(0, 0, -10);
pressw = true;
}
if (Input.GetKey ("d")) {
rb.AddForce(0, 0, 10);
pressw = true;
}
}
}
Thanks in advance! this is probably very basic but I'm not very good at this.
↧