CustomVehicleController
Last updated
Last updated
Method | Description |
---|---|
Property | (type) | Description |
---|---|
GetRigidbody()
Returns Rigidbody component used by the CustomVehicleController
GetCurrentCarStats()
Returns CurrentCarStats Scriptable Object instance used by the CustomVehicleController.
GetCenterOfMass()
Returns Transform which represents the CenterOfMass of the vehicle.
GetVehiclePreset()
Returns VehiclePartsPresetSO ScriptableObject, assigned to the CustomVehicleController.
VehiclePartsPresetSO holds references the the parts Scriptable Objects and is not intended for modifications.
GetCustomizableSet()
Returns VehiclePartsCustomizableSet instance used by the CustomVehicleController.
VehiclePartsCustomizableSet holds references the the parts Scriptable Objects and is intended for modifications.
SetVehiclePresetSO(VehiclePartsPresetSO newPreset)
Assigns new VehiclePartsPresetSO instance to the CustomVehicleController.
SetNewPartToCustomizableSet(IVehiclePart newPart, bool front = true)
Assigns new individual part to the VehiclePartsCustomizableSet instance used by the CustomVehicleController. Expects any Scriptable Object that is IVehiclePart (every part that the set uses). Part type will be determined automatically. If a part is a suspension or tires, it must also be specified whether it's for the front or rear part of the vehicle.
RemoveForcedInduction()
Sets the ForcedInductionSO that the VehiclePartsCustomizableSet uses to null
RemoveNitrous()
Sets the NitrousSO that the VehiclePartsCustomizableSet uses to null
UpdateWheelsRadiusFromMeshes()
Will recalculate the radius of the wheels based on the MeshRenderer's size.
AddNitroCharge(float amount)
Add the provided "amount" to the boost amount the vehicle currently has. If the added amount exceeds the maximum boost amount the bottle can contain, it will overflow into the next bottle.
SetNewEnginePart(CustomEnginePart newPart)
Accepts part types that derive from CustomEnginePart. If the vehicle already has a part of this type, it will be changed for a new part, otherwise a new part will be added to the list.
EnableInput(bool enable)
Enables or disables the input that the input provider component produces. When the input provider is disabled, shifting, steering, handbraking are disabled and, if the gas input isn't 0, the brake input will be equal to 1.
UsePreset | bool
If true, CustomVehicleController will use VehiclePartsPresetSO and its parts for the vehicle properties. Make sure that VehiclePartsPresetSO and none of its parts are null before setting the property to "True".
If false, CustomVehicleController will use VehiclePartsCustomizableSet and its parts for the vehicle properties. Make sure that none of its parts are null before setting the property to "False".
DrivetrainType | DrivetrainType
Sets the drivetrain type of the vehicle. Possible values:
RWD (Rear Wheel Drive). AWD (All Wheel Drive).
FWD (Front Wheel Drive)
TransmissionType | TransmissionType
Sets the transmission type of the vehicle. Affects the way the gears change.
Possible values:
Automatic.
Manual (user input only).
AerialControlsEnabled | bool
Enables vehicle aerial controls. The input is read from the class that implements IVehicleInputProvider
AerialControlsSensitivity | float
The amount of force applied in the pitch / yaw / roll rotation to the rigidbody. Force mode is ForceMode.Acceleration.
SteerAngle | float
Maximum steering angle in degrees
SteerSpeed | float
Time in which wheels will rotate to the "Steering Input" * "Maximum Steering Angle" angle. Wheels change their rotation linearly.
CenteringSpeed | float
Time in which wheels will rotate to their default state.
ForwardSlippingThreshold | float
Defines how much slipping is allowed until the wheel is considered to be forward slipping. Forward slipping occurs when acceleration force is higher than the wheel load * tire grip.
SidewaysSlippingThreshold | float
Defines how much slipping is allowed until the wheel is considered to be sideways slipping.
The slipping amount is the property of every tire. It equals to
1 - Sideways Slip Animation Curve at the (Dot Product of the tire right direction and vehicle velocity) value.
The amount of raycasts that go along the forward axis of the wheel with an offset from -radius to +radius.
VehiclePartsSetWrapper | VehiclePartsSetWrapper
Reference type field allows other classes to cache it and use the up-to-date parts scriptable objects. This class holds the parts that the vehicle is using either in the form of VehiclePartsPresetSO or a VehiclePartsCustomizableSet. This class has a static "OnAnyPresetChanged" event that triggers when any used part change in any vehicle occurs and a vehicle controller-specific "OnPartsChanged" event.
FrontAxles / RearAxles / SteerAxles | VehicleAxle[]
Arrays that hold the corresponding VehicleAxles. You can use the elements of these arrays to access the WheelController components, as an example, like this: FrontAxles[0].LeftHalfShaft.WheelController