Here is a script for AI Motor Mapping, and I get all the time this error for CarContoller: “The left-hand side of an assignment must be a variable, a property or an indexer”
Tried to solve this, but in vein.
using UnityEngine;
using System.Collections;
public class AIMotorMapping : MonoBehaviour {
[HideInInspector]
public float steerInput;
[HideInInspector]
public float throttleInput;
[HideInInspector]
public float brakeInput;
[HideInInspector]
public float handbrakeInput;
[HideInInspector]
public float steerMax;
[HideInInspector]
public float speedMax;
public Transform flWheelMesh;
public Transform frWheelMesh;
public bool usingAIDriverMotor = true;
private AIDriverMotor aIDriverMotor;
void Awake()
{
if (usingAIDriverMotor)
{
aIDriverMotor = this.GetComponent<AIDriverMotor>();
steerMax = aIDriverMotor.maxSteerAngle;
speedMax = aIDriverMotor.maxSpeed;
}
else
{
CarController = this.GetComponent<CarController>;
steerMax = 42;
speedMax = 250;
}
}
void Update () {
if (usingAIDriverMotor)
{
aIDriverMotor.aiSteerAngle = steerInput;
aIDriverMotor.aiSpeedPedal = throttleInput;
aIDriverMotor.aiBrakePedal = brakeInput;
}
else
{
CarController.steerInput = steerInput;
CarController.brakeInput = brakeInput;
if (throttleInput > 0)
{
CarController.throttleInput = throttleInput;
}
else
{
CarController.throttleInput = (-1) * throttleInput;
}
}
}
}