1. Add GVAI to vehicles
To add the GVAI to the vehicle, click
Tools -> Glauco Vehicles -> AI -> Add GVAI to vehicle

The automatic setup will add the necessary scripts and elements and will set the Sport preset to the vehicle. The preset can be changed in the appropriate section, then each preset can be changed according to your needs.

After choosing the preset, the AI is ready to go.
If there is a container waypoint in the
scene, just instantiate the vehicle in the scene.
2. GVAI Inspector elements, customize a preset
The existing presets allow you to configure most types of vehicles, it is possible to customize the preset by adjusting the parameters in this section.

2.1.
Settings
- AI settings
- Steer autopilot
Toggle the steering wheel autopilot.- Steer driving help level
The steering wheel driving help level.
- Steer driving help level
- Gas/brake autopilot
Toggle the gas/brake autopilot.- Gas/brake driving help
level
The gas/brake driving help level.
- Gas/brake driving help
level
- Opponent level
The opponent level.
- Circuit speed
The circuit speed, affects the vehicle’s speed.
- Steer autopilot
2.2.1. Steering wheel
settings
- Angle
- Reduction with speed
- Maximum angle at zero speed
The maximum steering wheel angle when the vehicle speed is zero and is controlled by the AI.
- Maximum angle at zero speed
- Smooth
- Raycast steer single smooth
Smooth out the steering wheel input fraction due to a single raycast.
- Raycast steer obstacle
smooth
Smooth out the steering wheel input fraction due to obstacles.
- Raycast steer vehicle
smooth
Smooth out the steering wheel input fraction due to other vehicles.
- Raycast steer navigator
smooth
Smooth out the steering wheel input fraction due waypoint positions.
- Raycast steer single smooth
- Sensitivity
- Steer sensitivity
Steering wheel sensitivity when the vehicle is controlled by AI.
- Steer sensitivity
- Helper
Apply forces to the vehicle that reduce skidding.
- Linear helper
Multiplier that varies the linear corrective forces.
- Angular helper
Multiplier that varies the angular corrective forces.
- Linear helper
- Reduction with speed
- Counter
Change the steering wheel angle when the vehicle direction does not match the steering wheel angle.
- Active
Toggle the counter steering wheel.
- Show gizmos
Toggle the counter steering wheel angle.
- Max angle correction
The maximum steering wheel angle correction.
- Start threshold
The threshold beyond which the counter is activated.
- Smooth
Smooth out the angle correction.
- Active
2.2.2. Speed settings
- Target speed range
The speed range consists of two values between 0 and 1.
- Maximum target speed
The maximum target speed, between 0 and 360 and greater than minimum target speed.
- Minimum target speed
The minimum target speed, between 0 and 360 and less than maximum target speed.
- First index position
- Min wp computation distance
It is used to establish the minimum distance of the first waypoint that must be used to calculate the straightness of the curve as the vehicle speed varies.
- Number of waypoint used
- Start wp distance multiplier
- Maximum target speed
Multiplier used to establish which is the first waypoint to use to
calculate the straightness of the curve as the vehicle speed varies.
- Speed parameter damper
The speed damper prameters.
- Throttle sensitivity
The throttle sensitivity.
- Brake sensitivity
The brake sensitivity.
- Target speed smooth
Smooth on the target vehicle speed.
- Height difference reducer
If there is an altitude difference in front of the vehicle, the speed will be reduced.
- Height difference amplifier
If there is an altitude difference in front of the vehicle, the speed will be increased.
- Limit speed when race is
over
When the race is over, the vehicle proceeds at this speed.
- Speed limit
Activates the speed limiter which prevents you from exceeding a certain speed.
- Maximum speed (kmh)
The maximum speed in km/h.
- Maximum speed (kmh)
- Throttle sensitivity
- Throttle/brake settings
- Sensitivity
The throttle and brake sensitivity.
- Smooth
Smooth out the throttle and the brake.
- Sensitivity
- Randomize behavior
Randomize the vehicle’s behavior.
- Randomize steer
- Active
Toggle the steering wheel randomization.
- Threshold
Speed threshold in km/h below which randomization is not applied.
- Time wait
Time before changing the randomized parameters.
- Increment
Increased variation of the steering wheel angle multiplier.
- Multiplier maximum
Maximum steering wheel angle variation.
- Multiplier value
Value that establishes how much the steering wheel angle varies when the randomized behavior is activated.
- Active
- Randomize steer
- Randomize speed
- Active
Toggle the speed randomization.
- Gas variation against other
vehicles
It establishes the intensity of the gas variation relative to the presence of other vehicles.
- Gas variation against
waypoints
It establishes the intensity of the gas variation relative to the waypoint’s positions.
- Time range
Minimum and maximum time before behavior is changed.
- Active
- Wait time before start
- Wait time
The waiting time before the vehicle starts moving after it has been instantiated.
- Wait time
2.2.3. Waypoints
- Input
- Navigator input steer
The sensitivity of the steering wheel due to waypoint’s position in the circuit.
- Raycast input steer
obstacle
The steering wheel sensitivity due to obstacle’s positions.
- Raycast input steer vehicle
The steering wheel sensitivity due to other vehicle’s positions.
- Raycast input gas
The gas sensitivity due to obstacle’s positions and other vehicle’s positions.
- Advanced
- Pass radius waypoint min
The minimum pass radius.
- Pass radius waypoint max
The maximum pass radius.
- Pass radius dot
The pass radius increases and decreases depending on the straightness of the road ahead of the vehicle. This parameter determines by how much the pass radius increases when the curve becomes straighter.
- Smooth pass radius dot
- Pass radius waypoint min
- Navigator input steer
- Pass radius speed
The pass radius increases and decreases with the speed of the vehicle. This parameter determines how much the pass radius increases when the vehicle speed increases.
- Smooth pass radius speed
Smooth out the pass radius speed.
- Total pass radius smooth
The total pass radius smooth out.
- Counter steer parameter
The counter steering wheel parameters.
- Smooth pass radius speed
- Waypoint position increase
smooth
Smooth out intensity when the pass radius increase.
- Waypoint position decrease
smooth
Smooth out intensity when the pass radius decrease.
- Ray reduction by distance
If active, then when the next waypoint distance increases, the raycast is reduced by a fraction of the distance.
- Amount
Multiplier of the “Ray reduction by distance”.
- Status
- Waypoint race container
The waypoints used by this vehicle.
- Waypoint race container
- Setup
- Toggle race waypoint setup
Toggle the waypoint setup system which allows to instantiate the waypoints directly moving the vehicle in play mode.
- Toggle race waypoint setup
- Ray to gas reduction
- Waypoint position decrease
smooth
Toggle the ray to gas reduction. When the raycast dependent is very large then the vehicle speed has to slow down.
- Amount
The ray to gas reduction amount
2.2.4. Raycast
- Global ray control
Vary the raycast parameters by acting globally on all of them.
- Test raycat
Show raycast gizmos in edit mode when vehicle is in scene (does not work in prefab view)
- Test raycat
- On
Turn on all rays.
- Off
Turn off all rays.
- Show
Show all ray gizmos.
- Hide
Hide all ray gizmos.
- Show off
Show all off ray gizmos.
- Hide off
Hide all off ray gizmos.
- Show line
Show all line ray gizmos.
- Hide line
Hide all line ray gizmos.
- Show sphere
Show all sphere gizmos.
- Hide sphere
Hide all sphere gizmos.
- Show label
Show all label gizmos.
- Hide label
Hide all label gizmos.
- Is gradient
Sets all ray gizmos as gradient.
- No gradient
Sets all ray gizmos as no gradient.
- Expand
Expand all rays in the inspector.
- Collapse
Collapse all rays in the inspector.
- Gradient intensity
The gizmos gradient intensity.
- Off
- Single ray control
Allows you to check the parameters of a single raycast.
The raycasts used by GVAI are:
- Front Center
- Front Oblique
- Front Parallel
- Front Wide
- Front Tight
- Front Short
- Side FrontFwd
- Side Front
- Side Center
- Side Rear
- Side Front Orto
- Off Road
For each the parameters are:
- On
Toggle a raycast.
- Show
Toggle a raycast gizmos.
- Show off ray
Show the raycast line when the ray hits nothing.
- Is gradient
The gizmos line is represented as a gradient color directly proportional to the intensity.
- Expand
- Color off
The raycast color line when it hits nothing.
- Color brake on
The raycast color line when it hits something and the ray affects the brake.
- Color steer on
The raycast color line when it hits something and the ray affects the steering wheel.
- Obstacle layers
The raycast obstacle layers.
- Color off
- Position
- Pivot left
The left raycast transform placeholder.
- Pivot right
The right raycast transform placeholder.
- Steer angle dependence
The raycast direction varies as the steering wheel angle varies.
- Raycast reduction by wp
distance
When active the contribution of the raycast is inversely proportional to the next waypoint distance.
- Pivot left
- Power
- Influence brake
Determines whether the raycast affects the brake.
- Power on vehicle brake variable
The intensity of the contribution to the brake of the raycast when it hits another vehicle. This value is inversely proportional to the distance.
- Power on vehicle brake constant
The intensity of the contribution to the brake of the raycast when it hits another vehicle. This value is constant.
- Power on obstacle brake variable
The intensity of the contribution to the brake of the raycast when it hits an obstacle. This value is inversely proportional to the distance.
- Power on obstacle brake constant
The intensity of the contribution to the brake of the raycast when it hits an obstacle. This value is constant.
- Other speed dependence brake
Toggle the speed dependence.
- Speed range brake
The speed range dependence.
- Minimum brake value
The minimum value is the speed difference is zero.
- Speed range brake
- Power on vehicle brake variable
- Influence brake
- Add steer from brake
When the intensity of the contribution given by the raycast is high then a variation of the steering wheel angle proportional to the intensity is added.
- Influence steer
Determines whether the raycast affects the steering wheel.
- Power on vehicle steer variable
The intensity of the contribution to the steering wheel angle of the raycast when it hits another vehicle. This value is inversely proportional to the distance.
- Power on vehicle steer constant
The intensity of the contribution to the steering wheel angle of the raycast when it hits another vehicle. This value is constant.
- Power on obstacle steer variable
The intensity of the contribution to the steering wheel angle of the raycast when it hits another vehicle. This value is inversely proportional to the distance.
- Power on obstacle steer constant
The intensity of the contribution to the steering wheel angle of the raycast when it hits another vehicle. This value is constant.
- Damper
Smooth out the raycast contribution.
- Amount
Damp amount.
- Amount
- Other speed dependence
Toggle the speed dependence.
- Speed range
The speed range dependence.
- Minimum steer value
The minimum value if the speed difference is zero.
- Speed range
- Power on vehicle steer variable
- Influence steer
- Length
- Length
The raycast length.
- Minimum obstacle distance
The minimum obstacle distance.
- Length speed dependance
Toggle the length speed dependance.
- Minimum length in low speed
The minimum ray length when the speed is low.
- Angle
The forward ray angle.
- Vertical angle
The vertical ray angle.
- Dependence from direction
The direction of the ray is reversed when the vehicle reverses it’s direction.
- Length
2.2.5. Raycast pivots
- Link ray cast pivots
Link the raycast pivots placeholders.
- Reset ray cast pivots
Re-add and set the raycast pivots.
2.2.6. Gizmos
- Raycast
Toggle the raycast gizmos.
- Gas/steer
Toggle the throttle and steering wheel gizmos.
- Direction
Toggle the direction gizmos.
2.
Preset
3. Waypoint setup.
GVAI uses a proprietary system to manage the vehicle movement with respect to obstacles and the position of waypoints.
Waypoints can be added in two different ways, the automatic system or with a manual setup in play mode.
3.2.
Setup with automatic system
To use the automatic waypoint system click on:
Tools -> Glauco Vehicles -> AI -> Add GVAI waypoint manager

The GVAI Waypoint Manager will be added to the scene:

Select this in the Hierarchy, in the inspector you will have:

Open the Waypoint setup section:

The automatic waypoint generation system uses layers to function.
First open the layer manager.
Tools -> Glauco Vehicles -> GV Layer manager

The layer manager will be opened in the inspector:

Here’s a list of the layers used by the various elements of the circuit.
You can change the layers in your scene to reflect those in the list or if you don’t want to change the layers in your scene, then select the layers used by you in the drop-down boxes.
The layers used by the waypoints automatic generation system are:
Road layer:
all road parts.
Offroad layer: all ground parts that are not part of the road and the vehicle
should not cross.
Curb layer:
the track curb.
Obstacle layer: all the obstacles present in the scene.
After these 4 layers have been set on all the objects in your scene it is necessary to establish which is the starting point of the circuit.
To do this it is necessary to instantiate the “Start element”.
To add the start element, place the mouse pointer at the point where the circuit begins and press the Control key and the left mouse button.

Orient the star element in the right direction.

Click the “Generate path elements” button to start generation.

The generation process will start, it may take from a few seconds to a few minutes.

Gray placeholders will be added in the middle of the road.
Blue placeholders will also be generated which serve as a preview to understand what the final position of the waypoints will be.


The default parameters are fine for most paths. It is possible to modify the parameters to adapt them to the type of circuit used.

Waypoints will be generated:

If the process has finished correctly and
the waypoints are positioned in the right way, it is possible to delete the
place holders by clicking on the “Remove path elements” button,
otherwise it is possible to improve the positioning of the place holders and
repeat the generation of waypoints.
3.3. Manual setup in play mode
Waypoints can be added directly by moving the vehicle in play mode.
Place a vehicle (with GVC and GVAI) in the scene where the path begins.

In the GVAI settings, click on the button
“Enable race waypoint setup”:

Press the Unity Play button to switch to play mode and drive the vehicle normally along the path you want to create. Waypoints will automatically be instantiated.

If the track is a loop, waypoint generation will stop automatically when the vehicle passes the first waypoint again.
If instead the circuit is open, to end the generation, just exit the play mode.
4. Waypoint manager
After the waypoints have been generated it is possible to make some changes on them.

- Create sequence
Rename the items inside the Waypoint Container giving sequentially numbered names.
- Smooth waypoints
Smooth the waypoint reducing the position oscillations.
- Align waypoints
Align the waypoints.
- Leans on the ground
Place waypoints on the ground if they are raised.
- Remove all waypoints
Remove all waypoints.
- Raises waypoint
Change the waypoints height relative to the ground.
- Start waypoint navigation
Start navigating along the waypoint path by attacking the Scene camera.
5. Starting grid setup
It is possible to automatically generate the starting grid. This grid is generated by taking the waypoints generated as a reference point.
To generate the starting grid, just click on the “Add starting grid” button:

The grid will be generated:

The “GVAI Starting grid” will be added in the hierarchy:

By selecting the “GVAI Starting grid”, it will be possible to perform some operations on the starting grid.

6. TV Camera setup
It is possible to automatically add a series of place holders to manage TV cameras.

Click the “Add new TV camera container” button
The “GVC TV Camera Container 1” will be added into the scene.

By selecting this:

Click on the “Auto generate TV cameras” button and the TV camera place holders will be generated and added to the scene:

The TV cameras will be visible in the Hierarchy and in the scene:

7. Preparing the scene
7.2. Adding GVAI Scene Manager
For the correct functioning of GVAI it is necessary to add the GVAI Scene Manager to the scene.
Click on:
Tools -> Glauco Vehicles -> AI -> Add GVAI SceneManager to scene

Select the GVAI Scene Manager:

The “GVAI SceneManager” allows you to determine which vehicles will be instanced in the scene, the number of vehicles and on which circuit.

First, determine how many different vehicles will be present.
Then select the number in the box, suppose we choose 2 different vehicles possible:

Now we drag each vehicle into the appropriate box, on these vehicle GVC and GVAI must already be installed.


The vehicle must be active in order to be instantiated.

Then choose which path the vehicle must follow by selecting the GVAI Waypoint manager

It is possible to set the color of some vehicle materials.
To do this, enter the number of materials whose color you want to change, in the example only one material.

and drag the material into the appropriate box and check the “Random Colors” check box.

in this way random colors will be assigned to the selected material.
Otherwise it is possible to choose among the colors you set.
To do this, enter the number of colors in the box, 4 in this example, the choose four colors.

In this way, one of the 4 colors will be randomly assigned to the chosen material.
The “Canvas Led Display” check box allows you to choose the type of display used for the engine RPM and for the vehicle speed within the canvas.
Led display:

Needle display:

When the “Jump pos” check box is active, the vehicles will be arranged on the grid by jumping 2 positions, which can be useful if there are very long vehicles.

7.3. GVAI Scene Manager settings

- Drivers
The number of vehicles that will be instantiated in the scene.
- Player vehicle
It is the index of the vehicle that will be set as a player, so if for example the player starts from the third position in the starting grid, then select 3.
- Lap number
The number of laps needed to complete the race.
- Show help arrows
Toggle the help arrows.
- Opponent level
The opponent level.
- Circuit speed
The speed of this circuit. - Vehicle deformation
Toggle the vehicle deformation after a bump.
- Wait time before start
The time from the moment the vehicle is instantiated and the moment it starts moving. If the semaphore is active and has five lights, the time to set is 6 seconds.