Esempio n. 1
0
    void Start()
    {
        lastPosition = transform.position;

        GameObject meshPrefab = meshName == null || meshName.Length == 0 ? VehicleModelManager.GetRandomVehicleModel() : VehicleModelManager.GetVehicleModel(meshName);
        var        meshObject = Instantiate(meshPrefab);

        meshObject.transform.SetParent(transform, false);
        bodyMesh = meshObject.GetComponent <MeshRenderer>();
        bodyMesh.material.color = Color.HSVToRGB(Random.Range(0.0f, 1.0f), 1.0f, 1.0f);

        targetSpeed        = maxSpeed;
        transform.position = roundabout.GetPointOnLane(CurrentLane, CurrentAngle);
        transform.forward  = GetTangentToRoundabout();
    }
Esempio n. 2
0
    Vector3 GetForward()
    {
        Vector3 nextPos = roundabout.GetPointOnLane(CurrentLane, CurrentAngle + 1.0f);

        return((nextPos - transform.position).normalized);
    }