- Home /
move around script help me
var speed = 3.0; var rotateSpeed = 3.0; function Update () { var controller : CharacterController = GetComponent(CharacterController); transform.Rotate(0, Input.GetAxis ("Horizontal") rotateSpeed, 0); var forward = transform.TransformDirection(Vector3.forward); var curSpeed = speed Input.GetAxis ("Vertical"); controller.SimpleMove(forward * curSpeed); } @script RequireComponent(CharacterController)
this work but not work good pleas help me
I took the liberty to re-paste your code and format it. Otherwise it'd be impossible to understand. In the future, please remember to format your code properly. Just select the text and click the 'code' button in the post toolbar (that's the one with binary on it) or press ctrl+$$anonymous$$.
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.Simple$$anonymous$$ove(forward * curSpeed);
}
@script RequireComponent(CharacterController)
Now, what exactly isn't working for you? Does it work at all? Any weird behaviors?
I see that you forgot to declare the type of the variables (I fixed that), but other than that it's nearly identical to the sample script from the documentation. Is there anything else? Can you describe what's not working with more detail please? $$anonymous$$aybe paste the errors from the console as well?
Hi there, once I run the script, the sphere drop down automatically. But I can't control it move forward or backward via keyboard.
Answer by nejilee · Oct 05, 2011 at 06:40 PM
i repair all errors but leave my project can you tell me where can i find a site for fps game tutorial
Answer by Hassam1957234 · Dec 16, 2012 at 08:44 PM
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)
Answer by jmc50 · Aug 06, 2016 at 05:51 AM
My move around script didn't work I copy and past from tornatotwins. but thanks for trying My java might not be updated for this
Your answer