August 2018
Beginner
334 pages
10h 19m
English
Let's start by creating the interface to control the car. This interface is a MonoBehaviour class with public members, so the player and the agents could interact with it easily and seamlessly:
using UnityEngine;public class CarController : MonoBehaviour{ // next steps}
public float speed;public float maxSpeed;public float steering;public float maxSteering;public Vector3 velocity;
private void Update(){ transform.Rotate(Vector3.up, steering, Space.Self); transform.Translate(Vector3.forward * speed * Time.deltaTime, Space.World);}
Now, we will also ...
Read now
Unlock full access