Setting up a Smart Car vehicle

As Smart Car uses a realistic car setup, there are many options to configure your vehicle. To create a Smart Car vehicle, you'll need a car model with different models for wheels and Unity wheel colliders setup on them. After adding a car model to your scene, import the Smart Car 2.3 package and attach the SmartAICar2_3.cs script from SmartAICar2.3/Scripts. In the following screenshot, you can see some of the Smart Car AI fields from the script:

Setting up a Smart Car vehicle

There are fields here you can customize such as Engine properties, including Engine Torque Curve, and the distances for the ray casts used for sensing. Most of these can be left to default values, but to run the script, you'll need to fill in the wheel properties, dragging from your model the colliders for the four wheels to the Wheel_FL, Wheel_FR, Wheel_RL, and Wheel_RR properties. You also need transforms for the wheel set. Also, there needs to be a transform for center of mass (COM), a lower point in the middle of the car. If COM is placed in the wrong position, the physics of the car can be very unexpected. If you fill these out, the car is set up but it still won't run in a game as it still needs waypoints and a Unity navigation mesh setup, which we will add in the demo.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.223.208