- Home /
This question was
closed Apr 15, 2013 at 03:00 PM by
Graham-Dunnett for the following reason:
Problem is not reproducible or outdated - no specific question asked
Question by
finanshow · Apr 15, 2013 at 02:29 PM ·
charactercontroller
MoveAround js problems
A Sphere in the scene added with a Character Controller componnet. Here is the js I want to control the sphere could be move by keyboards. Here is my code refer to the famous Unity3D tutorial in Youtube.
var speed: float = 3.0;
var rotateSpeed: float = 3.0;
function Update ()
{
var controller : CharacterController = GetComponent(CharacterController);
transform.Rotate(0, Input.GetAxis ("Horizontal") * rotateSpeed, 0);
var forward : Vector3 = transform.TransformDirection(Vector3.forward);
var curSpeed : float = speed * Input.GetAxis ("Vertical");
controller.SimpleMove(forward * curSpeed);
}
@script RequireComponent(CharacterController)
Thanks!
Comment
Follow this Question
Related Questions
3rd person Controler walk 0 Answers
Unity drops my variables after a couple times 0 Answers
CharacterController unexpected collisions with MeshCollider 0 Answers
CharacterController velocity problem 1 Answer
[fixed] OnTriggerExit never called if I change Character Controller center in-script... 2 Answers