Class VehicleConfiguration

Configuration for a vehicle. It describes the various components of a vehicle, like engine, transmission and wheels and how they behave. A Vehicle component can be used to create a vehicle from the configuration.

Hierarchy (view full)

Constructors

Accessors

  • get body(): Template
  • Template for the vehicle body. This is intended to contain the Renderable that is used to render the vehicle body and the Collider that provides collisions for the vehicle body. It may also contain any other scene objects and components. It is also possible to put the scene objects and components for the vehicle wheels in this template. In this case, the wheels have to be configured such that the visual model is a path pointing to these objects. Note that the wheels should not have any active Collider components.

    Returns Template

  • set body(value): void
  • Template for the vehicle body. This is intended to contain the Renderable that is used to render the vehicle body and the Collider that provides collisions for the vehicle body. It may also contain any other scene objects and components. It is also possible to put the scene objects and components for the vehicle wheels in this template. In this case, the wheels have to be configured such that the visual model is a path pointing to these objects. Note that the wheels should not have any active Collider components.

    Parameters

    Returns void

  • get bodyHandle(): ResourceHandle<Template>
  • Template for the vehicle body. This is intended to contain the Renderable that is used to render the vehicle body and the Collider that provides collisions for the vehicle body. It may also contain any other scene objects and components. It is also possible to put the scene objects and components for the vehicle wheels in this template. In this case, the wheels have to be configured such that the visual model is a path pointing to these objects. Note that the wheels should not have any active Collider components.

    Returns ResourceHandle<Template>

  • set bodyHandle(value): void
  • Parameters

    Returns void

  • get isDestroyed(): boolean
  • Determines if the resource is destroyed.

    Returns boolean

    This can happen when the Resource was forcefully unloaded or reverted. For this reason, it is safer to hold on to a instead of directly referencing a resource pointer, as the current Resource can always be retrieved via .value.

  • get mass(): number
  • The mass of the entire vehicle. This overrides any mass set on the Rigidbody component used to simulate the vehicle.

    Returns number

  • set mass(value): void
  • Parameters

    • value: number

    Returns void

  • get name(): string
  • Name of the resource. Use primarily for easier identification and not important to the engine itself.

    Returns string

  • get uuid(): UUID
  • Returns a universally unique identifier of this resource.

    Returns UUID

  • get wheelCollisionRadius(): number
  • Radius of the wheel collision tester. Only relevant for sphere cast testing. When using sphere cast testing, the wheels are approximated as spheres for collision tests. With tall, slim wheels this may lead to issues where the sphere is too wide and causes collisions even though it shouldn't. With this property, the radius of the sphere can be set to a lower number to avoid these collisions. Note that this may cause the wheel to clip into the ground when driving over a sharp edge, similar to ray casts.

    Returns number

  • set wheelCollisionRadius(value): void
  • Parameters

    • value: number

    Returns void

Methods

  • Adds the specified anti-roll bar to this configuration.

    Parameters

    Returns void

    For performance reasons, prefer this over accessing antiRollBars directly.

  • Adds the specified differential to this configuration.

    Parameters

    Returns void

    For performance reasons, prefer this over accessing differentials directly.

  • Adds the specified suspension part to this configuration.

    Parameters

    Returns void

    For performance reasons, prefer this over accessing suspensionParts directly.

  • Adds the specified wheel to this configuration.

    Parameters

    Returns void

    For performance reasons, prefer this over accessing wheels directly.

  • Duplicates the resource and creates a unique UUID for the duplicated resource.

    Returns Resource

    The duplicated resource or null, if the duplication failed.

  • Get the specified anti-roll bar configuration.

    Parameters

    • index: number

      The index of the anti-roll bar to get.

    Returns VehicleAntiRollBarConfiguration

    The anti-roll bar configuration for the specified index or an empty configuration when out of bounds.

    For performance reasons, prefer this over accessing antiRollBars directly.

  • Get the amount of anti-roll bars in this configuration.

    Returns number

    For performance reasons, prefer this over accessing antiRollBars directly.

  • Get the amount of differentials in this configuration.

    Returns number

    For performance reasons, prefer this over accessing differentials directly.

  • Get the amount of suspension parts in this configuration.

    Returns number

    For performance reasons, prefer this over accessing suspensionParts directly.

  • Get the specified wheel configuration.

    Parameters

    • index: number

      The index of the wheel to get.

    Returns VehicleWheelConfiguration

    The wheel configuration for the specified index or null when out of bounds.

    For performance reasons, prefer this over accessing wheels directly.

  • Get the specified wheel configuration.

    Parameters

    • name: string

      The name of the wheel to get.

    Returns VehicleWheelConfiguration

    The wheel configuration for the specified index or null when not found.

  • Get the amount of wheels in this configuration.

    Returns number

    For performance reasons, prefer this over accessing wheels directly.

  • Finds the index of the specified wheel in this configuration.

    Parameters

    Returns number

    The index of the wheel or null if the wheel is not part of this configuration.

  • Virtual

    Method called by RSX to perform actions required after the creation of the resource.

    Returns void

  • Virtual

    Method called by RSX to perform any operations needed after deserialization.

    Returns void

    Use this API to restore your serializable data into live objects.

  • Virtual

    Method called by RSX to disable the resource.

    Returns void

    Use this API to deactivate the resource before it is serialized.

  • Virtual

    Method called by RSX to enable the resource.

    Returns void

    Use this API to activate the resource after it has been disabled by serialization.

  • Virtual

    Method called by RSX to perform initialization of the resource.

    Returns void

    Use this API to initialize data and default construct all fields.

  • Virtual

    Method called by RSX to perform any operations before serialization.

    Returns void

    Use this API to bake your live data into serializable data.

  • Removes the specified anti-roll bar from this configuration.

    Parameters

    Returns void

    For performance reasons, prefer this over accessing antiRollBars directly.

  • Removes the specified differential from this configuration, if present.

    Parameters

    Returns void

    For performance reasons, prefer this over accessing differentials directly.

  • Removes the specified suspension part from this configuration.

    Parameters

    Returns void

    For performance reasons, prefer this over accessing suspensionParts directly.

  • Removes the specified wheel from this configuration, if present.

    Parameters

    Returns void

    For performance reasons, prefer this over accessing wheels directly.

  • Reverts the resource to the on-disk representation.

    Returns boolean

    This is a potentially expensive call, as it needs to deserialize and replace all existing in-memory resource handles.