HoverVehicle Component

HoverVehicle

The HoverVehicle Component is responsible for managing the proper execution of the other HoverKit components (HoverLift, HoverMovement, HoverTurning), as well as providing convenient centralized access to those components via cached public properties.

It is also responsible for keeping the vehicle upright and aligned with the ground surface, and allows the developer to specify how this auto-correcting functionality is performed.

Physics

Target Rigid Body

Specifies which Rigidbody instance the component will operate on. If this field is left empty, on startup the HoverLift component will attempt to obtain a reference to a Rigidbody component on the same GameObject.

hoverlift-physics-section

Auto Leveling

Up Vector

When the vehicle is not currently grounded (such as during a jump or fall), it will attempt to automatically correct its orientation in order to remain upright and aligned with the ground surface. The UpVector field is a Vector3 value which specifies which direction should be considered “upright” for the vehicle and allows the vehicle to automatically align to any orientation. This field defaults to the standard World Up direction.

COM_Offset

Specifies an optional offset for the Rigidbody’s Center of Mass, which can assist in keeping the vehicle upright when the vehicle is not on the ground (by making it effectively “bottom heavy”). By default, this value is set to be one meter below the vehicle’s Transform.

Leveling Stability

Controls the amount of stabilization performed when the vehicle is not grounded. If set to zero, no stabilization will be performed.

Leveling Speed

Controls how quickly stabilization should be achieved when the vehicle is not grounded. If set to zero, no stabilization will be performed.

Ground Vehicle at Startup

If set to TRUE, an attempt will be made at startup (in the OnEnable method) to perfectly position and align the vehicle to the ground surface. This value defaults to FALSE.

hoverlift-auto-levelling

Quick Configuration Button

The inspector for the HoverVehicle component has a Quick Configuration button at the top which when pressed will present a dialog that allows you to enter some simplified values that HoverKit will use to populate the HoverLift, HoverMovement, and HoverTurning components with reasonable default values.

This is intended to make it easier to create new hovercraft types, because it reduces the many available options on three different types of components down to a few options on a single dialog. While it doesn’t offer the full range of customization and tweaking that the individual components do, it does help choose good starting values that will give you a jump start when creating a new vehicle.

Vehicle Mass

Estimate Vehicle Mass

In order to calculate these default values either the component must have the TargetRigidBody field assigned to a Rigidbody instance, or the GameObject on which the component is attached must include a Rigidbody component.

The mass of the Rigidbody is critical in determining the appropriate default values for the physics forces. HoverKit can estimate the vehicle’s mass based on the size of the vehicle’s Colliders, if desired. If you’ve already assigned the vehicle’s mass, then deselect this option to retain the current value.

Hovering

Hover Height

This field specifies how high the vehicle should hover above the ground surface.  The HoverLift component will always try to maintain this distance between each HoverPoint entry and the ground surface above which it is located.

Hover Behavior

Roughly describes how the HoverLift component will respond when the vehicle drives over uneven terrain, experiences a collision, or undergoes a rapid change in elevation. Possible values are Bouncy, Default, or Stiff.

Attraction to Surface

This is how strongly the vehicle will attempt to remain on the ground surface. This can be used to choose from a range between very bouncy craft that easily become airborne and cannot climb steep slopes,  to vehicles that stick to a track or surface no matter their orientation. Possible values are None, Low, Default, or High.

Moving

Maximum Speed

The maximum vehicle speed is required in order to properly calculate the forces needed to accelerate the vehicle to the desired speed. The value you select here will be used to calculate the maximum velocities and forces for the forward, backward, and lateral directions.

Drift Cancellation

Specifies the amount of momentum cancellation that will be applied. Higher values will result in the vehicle coming to a stop quicker, while lower values will cause the vehicle to drift longer before coming to a stop. If this value is set to zero, no momentum cancellation will be performed, and the vehicle will drift forever in the last direction of movement.

Perhaps more importantly, drift cancellation is also used when the vehicle is cornering, to counter the sideways drift that results from the previous forward movement. In this case, higher DriftCancellation values will result in sharper turns with less sideways drift, while lower values will result in wide cornering and more sideways drift.

Turning

Maximum Turn Speed

Sets the maximum turn speed (in degrees per second) along the local Y axis.

Raycast Locations

This is an array of Transforms that specify each location where the HoverLift component should perform a raycast to the ground surface. For every Transform in this array, a raycast will be performed from the Transform’s world position along the Transform’s down direction. These Transforms can be empty GameObjects or child objects of the vehicle. They must be properly located in order to provide the correct balance, and the array should contain only as many entries as needed to provide a stable hovering behavior. As an example, you might choose to create empty GameObjects as a child of the vehicle, and place them at the four “corners” of the bottom of the vehicle with an unobstructed path for raycasting downward.

Check each of the Transforms in this list that specify where HoverKit should perform a raycast.

HoverVehicle API Documentation

View the API documentation for the HoverVehicle Component class online.