- Home /
Help Please Debug A Script - Fixed!
Could someone good with Unity Javascript take a peek at this script and let me know if I am missing any brackets or other syntax. The errors Im getting in MonoDevelop are: Expecting ( Found Fixed Update, ; expected at the end. Unexpected token if Unexpected token var Expected EOF found }
/Arrow Turn Function function FixedUpdate(){
if (Input.GetAxis("Turn")){
var rotation : float = (Input.GetAxis("Turn")) * rotationSpeed * rotationSensativity;
rotation = rotation + transform.eulerAngles.y;
transform.localRotation = Quaternion.AngleAxis ( rotation, Vector3.up);
}
I am still getting errors with this script. I appreciate the help. Thank you.
Assets/Standard Assets/Character Controllers/Sources/Scripts/FPAdventurerInputController.js(41,13): BCE0044: expecting (, found 'FixedUpdate'.
Assets/Standard Assets/Character Controllers/Sources/Scripts/FPAdventurerInputController.js(45,9): BCE0043: Unexpected token: if.
Assets/Standard Assets/Character Controllers/Sources/Scripts/FPAdventurerInputController.js(46,4): BCE0044: expecting ), found '{'.
Assets/Standard Assets/Character Controllers/Sources/Scripts/FPAdventurerInputController.js(46,5): UCE0001: ';' expected. Insert a semicolon at the end.
function FixedUpdate ();
{
if (Input.GetAxis("Turn")
{ var rotation : float = Input.GetAxis("Turn") rotationSpeed rotationSensitivity ; // add the rotation to the current orientation amount
rotation = rotation + transform.eulerAngles.y ; // convert degrees to quaternion for the up axis, Y transform.localRotation = Quaternion.AngleAxis ( rotation, Vector3.up ) ;
}
@$$anonymous$$erries or whom ever is watching...
The first script, does that enable a character to actually turn left and right ins$$anonymous$$d of strafing? I was trying to edit the FPS controller script and was getting almost the exact error message as you.
I was wondering does that script work now as the way you have it wrote?
This is not an answer! If you have your own question post it as question. Otherwise use "add new comment" if you want to comment on a specific post.
Answer by FLASHDENMARK · Mar 01, 2012 at 07:36 PM
//Arrow Turn Function //See the notes below
function FixedUpdate(){
if (Input.GetAxis("Turn")){
var rotation : float = (Input.GetAxis("Turn")) * rotationSpeed * rotationSensativity;
rotation = rotation + transform.eulerAngles.y;
transform.localRotation = Quaternion.AngleAxis ( rotation, Vector3.up);
}
}
// Require a character controller to be attached to the same game object
@script RequireComponent (CharacterMotor)
@script AddComponentMenu ("Character/FPS Input Controller")
You used one / and a comment uses two /'s not one. I'm am sure that was an honest mistake.