- Home /
'motorTorque' is not a member of 'System.Type'.
Hi, I'm trying to make my first car-game work.
var leftWheel = WheelCollider; var rightwheel = WheelCollider; var maxtorque = 260.0;
function Start () { rigidbody.centerOfMass.y = 0; }
function FixedUpdate () { leftWheel.motorTorque = maxtorque Input.GetAxis("Vertical"); rightwheel.motorTorque = maxtorque Input.GetAxis("Vertical");
leftWheel.steerAngle = 10 * Input.GetAxis("Horizontal");
rightwheel.steerAngle = 10 * Input.GetAxis("Horizontal");
}
This script produces an error I can't understand.
Assets/Driving.js(10,19): BCE0019: 'motorTorque' is not a member of 'System.Type'. Assets/Driving.js(11,20): BCE0019: 'motorTorque' is not a member of 'System.Type'. Assets/Driving.js(13,19): BCE0019: 'steerAngle' is not a member of 'System.Type'. Assets/Driving.js(14,20): BCE0019: 'steerAngle' is not a member of 'System.Type'.
What went wrong here and how can I fix it?
Thanks - dark andy
It's rude, because it wastes people's time, to post the same question in multiple places, and not alert your readers about it.
Answer by Henrique Vilela · May 10, 2011 at 12:49 PM
Your error is on the first two lines.
var leftWheel = WheelCollider;
var rightwheel = WheelCollider;
You're associating the type WheelCollider to the variables. What you should do is set the values by the inspector.
var leftWheel;
var rightwheel;