- Home /
Question by
KenBrace · Jul 14, 2015 at 02:39 PM ·
charactercharactercontrollerfunctionmovesimplemove
Move() function doesn't work on character controller!
What's wrong with the Move() and SimpleMove() functions?
When I use them on a character controller they highlight in red and create an error log in the console.
Has this function been deprecated?
Here is my code...
using UnityEngine;
using System.Collections;
public class CharacterController : MonoBehaviour {
public float MoveSpeed;
public float RotationSpeed;
CharacterController cc;
void Start()
{
cc = GetComponent <CharacterController> ();
}
void Update()
{
transform.Rotate (new Vector3(0, Input.GetAxis ("Horizontal") * RotationSpeed * Time.deltaTime, 0));
Vector3 forward = Input.GetAxis ("Vertical") * transform.TransformDirection(Vector3.forward) * MoveSpeed;
cc.Move (forward);
}
}
Comment