basic vehicle script, need some help with an error.

so unity is telling me:
Assets/car/car.js(17,9): BCE0005: Unknown identifier: ‘wheelRL’.
Assets/car/car.js(14,9): BCE0005: Unknown identifier: ‘wheelRR’.
Assets/car/car.js(14,9): BCE0005: Unknown identifier: ‘wheelFR’.
Assets/car/car.js(14,9): BCE0005: Unknown identifier: 'wheelFL.

and,

Assets/car/car.js(25,14): BCE0005: Unknown identifier: ‘input’.

this is the script:

var WheelFR : UnityEngine.WheelCollider;
var WheelFL : UnityEngine.WheelCollider;
var WheelRR : UnityEngine.WheelCollider;
var WheelRL : UnityEngine.WheelCollider;

var speed = 10;
var braking = 20;

var turning = 20;

function update ()
{
//this code makes the car go forward
wheelRR.motortorque = Input.GetAxis(“vertical”) * speed;
wheelRL.motortorque = Input.GetAxis(“vertical”) * speed;

wheelRL.motortorque = 0;
wheelRR.motortorque = 0;

//this code makes the car turn
wheelFL.steerangle = Input.GetAxis(“horizontal”) * turning;
wheelFR.steerangle = Input.GetAxis(“horizontal”) * turning;

//this code puts brakes on the car
if ( input.getkey(KeyCode.spacebar))
{
wheelRL.braketorque = braking;
wheelRR.braketorque = braking;
}
}

can anyone help me out with this? i followed a youtube video and he didnt run into these issues, but then again he only put .wheelcollider when unity told me to do unityengine.wheelcollider… so i think maby he was on 3.5… idk

sorry update on my part i see the issue, the W needed to be capitol for Wheel and Input, now i added the script to a basic cube with 4 wheel colliders and the wheel colliders are assigned in the script part of the inspector, but when i try and move the car wont move, and im getting no compile errors?

Update must be in proper case aswell. Case must always match.

i dont know what that means, sorry, im new to scripting all i did was follow a tutorial…

Update() not update()

ah gotcha, so does anyone know what this means?

MissingFieldException: UnityEngine.WheelCollider.motortorque
Boo.Lang.Runtime.DynamicDispatching.PropertyDispatcherFactory.FindExtension (IEnumerable`1 candidates)
Boo.Lang.Runtime.DynamicDispatching.PropertyDispatcherFactory.Create (SetOrGet gos)
Boo.Lang.Runtime.DynamicDispatching.PropertyDispatcherFactory.CreateSetter ()
Boo.Lang.Runtime.RuntimeServices.DoCreatePropSetDispatcher (System.Object target, System.Type type, System.String name, System.Object value)
Boo.Lang.Runtime.RuntimeServices.CreatePropSetDispatcher (System.Object target, System.String name, System.Object value)
Boo.Lang.Runtime.RuntimeServices+c__AnonStorey19.<>m__F ()
Boo.Lang.Runtime.DynamicDispatching.DispatcherCache.Get (Boo.Lang.Runtime.DynamicDispatching.DispatcherKey key, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)
Boo.Lang.Runtime.RuntimeServices.GetDispatcher (System.Object target, System.String cacheKeyName, System.Type[ ] cacheKeyTypes, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)
Boo.Lang.Runtime.RuntimeServices.GetDispatcher (System.Object target, System.Object[ ] args, System.String cacheKeyName, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)
Boo.Lang.Runtime.RuntimeServices.SetProperty (System.Object target, System.String name, System.Object value)
car.Update () (at Assets/car/car.js:14)

Uppercase = capitol letters
Lowercase = normal letters

Case sensitive means Update is not the same as update

You will find you get errors like this in Unity as it is case sensitive.

Things like GameObject and gameObject can cause trouble as well.

http://docs.unity3d.com/Documentation/ScriptReference/WheelCollider-motorTorque.html

thanks for the link, but i still dont understand what the error is trying to tell me.

The correct name is motorTorque not motortorque - hence the MissingFieldException (there is no field named motortorque)

ahh, let me correct that and see what happens.

ok i fixed that and also steerangle needed to be steerAngle, now im getting this,

MissingMethodException: UnityEngine.Input.getkey
Boo.Lang.Runtime.DynamicDispatching.MethodDispatcherFactory.ProduceExtensionDispatcher ()
Boo.Lang.Runtime.DynamicDispatching.MethodDispatcherFactory.Create ()
Boo.Lang.Runtime.RuntimeServices.DoCreateMethodDispatcher (System.Object target, System.Type targetType, System.String name, System.Object[ ] args)
Boo.Lang.Runtime.RuntimeServices.CreateMethodDispatcher (System.Object target, System.String name, System.Object[ ] args)
Boo.Lang.Runtime.RuntimeServices+c__AnonStorey15.<>m__9 ()
Boo.Lang.Runtime.DynamicDispatching.DispatcherCache.Get (Boo.Lang.Runtime.DynamicDispatching.DispatcherKey key, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)
Boo.Lang.Runtime.RuntimeServices.GetDispatcher (System.Object target, System.String cacheKeyName, System.Type[ ] cacheKeyTypes, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)
Boo.Lang.Runtime.RuntimeServices.GetDispatcher (System.Object target, System.Object[ ] args, System.String cacheKeyName, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)
Boo.Lang.Runtime.RuntimeServices.Invoke (System.Object target, System.String name, System.Object[ ] args)
UnityScript.Lang.UnityRuntimeServices.Invoke (System.Object target, System.String name, System.Object[ ] args, System.Type scriptBaseType)
car.Update () (at Assets/car/car.js:25)

im trying to see if i typed it wrong right now, any input would help from you guys and thanks for your patience, your helping me learn.

is it telling me to put Unityengine infront of input?

like this? UnityEngine.Input.getKey?

ok, i have fixed another issue, i had:

//this code puts brakes on the car
if ( UnityEngine.Input.GetKey(KeyCode.Spacebar))

it needed to be:

//this code puts brakes on the car
if ( UnityEngine.Input.GetKey(KeyCode.Space))

now im not getting any errors but the box i made with wheel colliders still isnt moving, i gave the wheel colliders targets when i dragged the script into the box as well.

how do you post code the correct way? anyways here is what i have, and the car still wont move… but i dont have any console errors.

var WheelFR : UnityEngine.WheelCollider;
var WheelFL : UnityEngine.WheelCollider;
var WheelRR : UnityEngine.WheelCollider;
var WheelRL : UnityEngine.WheelCollider;

var speed = 10;
var braking = 20;

var turning = 20;

function Update ()
{
//this code makes the car go forward
WheelRR.motorTorque = Input.GetAxis(“Vertical”) * speed;
WheelRL.motorTorque = Input.GetAxis(“Vertical”) * speed;

WheelRL.motorTorque = 0;
WheelRR.motorTorque = 0;

//this code makes the car turn
WheelFL.steerAngle = Input.GetAxis(“Horizontal”) * turning;
WheelFR.steerAngle = Input.GetAxis(“Horizontal”) * turning;

//this code puts brakes on the car
if ( UnityEngine.Input.GetKey(KeyCode.Space))
{
WheelRL.brakeTorque = braking;
WheelRR.brakeTorque = braking;
}
}

Probably because you set the torque to zero right after you assign it based on input.

Re: code tags - http://forum.unity3d.com/threads/143875-Using-code-tags-properly

if i set them to anything but zero the car moves by itself, and all i can do i brake. im starting to think its something else instead of the code at this point. does any one mind pluggin this code into a cube with wheel colliders and see if they can find out whats wrong?

var WheelFR : UnityEngine.WheelCollider;
var WheelFL : UnityEngine.WheelCollider;
var WheelRR : UnityEngine.WheelCollider;
var WheelRL : UnityEngine.WheelCollider;

var speed = 10;
var braking = 20;

var turning = 20;

function Update ()
{
 	//this code makes the car go forward
 	WheelRR.motorTorque = Input.GetAxis("Vertical") * speed;
 	WheelRL.motorTorque = Input.GetAxis("Vertical") * speed;
 
 	WheelRL.motorTorque = 0;
 	WheelRR.motorTorque = 0;
 
 	//this code makes the car turn
 	WheelFL.steerAngle = Input.GetAxis("Horizontal") * turning;
 	WheelFR.steerAngle = Input.GetAxis("Horizontal") * turning;
 
 	//this code puts brakes on the car
 	if ( UnityEngine.Input.GetKey(KeyCode.Space))
 	{
 	WheelRL.brakeTorque = braking;
 	WheelRR.brakeTorque = braking;
 	}
 }

I’d check your Input Manager and see what the Vertical and Horizontal axes are bound to. It sounds like you’re picking up input when you don’t want to.

vertical
positive: up
negative: down
alt pos: w
alt neg: s
gravity: 3
dead: 0.01
snap is checked
key or mouse button
x axes

horizontal is the same exept is is using left and right and A and D.

i have two horizontal and vertical tabs though?

no body?

var WheelFR : UnityEngine.WheelCollider;
var WheelFL : UnityEngine.WheelCollider;
var WheelRR : UnityEngine.WheelCollider;
var WheelRL : UnityEngine.WheelCollider;
 
var speed = 10;
var braking = 20;
var turning = 20;

function Update ()
{
    //this code makes the car go forward
    WheelRR.motorTorque = Input.GetAxis("Vertical") * speed;
    WheelRL.motorTorque = Input.GetAxis("Vertical") * speed;
 
    //this code makes the car turn
    WheelFL.steerAngle = Input.GetAxis("Horizontal") * turning;
    WheelFR.steerAngle = Input.GetAxis("Horizontal") * turning;

    //this code puts brakes on the car
    if ( UnityEngine.Input.GetKey(KeyCode.Space))
    {
      WheelRL.brakeTorque = braking;
     WheelRR.brakeTorque = braking;
     } 
    else 
    {
      WheelRL.brakeTorque = 0;
     WheelRR.brakeTorque = 0;
    }

 }