Player Car

Common Info

  • Each player car only works in Hybrid custom physics type & consists of 2 parts: DOTS entity is handled by DOTS systems & Monobehaviour hybrid skin (required for camera tracking & npc car layout) that follows the binded DOTS entity.

  • Player hybrid skin car should have following components:

    • Player Actor : camera tracking component.

    • PlayerNpcCarBehaviour : logic of the NPC shooting from the car.

    • CarSlots : stores the NPC data that is in the car (Npcs sitting in the car are taken from the PlayerNpcCarFactory).

    Note

    Look at PlayerCarSkinBase prefab example.

Hybrid DOTS

  • Player vehicle physics handled by DOTS systems.

  • The hybrid skin follows the DOTS entity.

How To Create

  1. Open Car Prefab Creator & set Car type to Player in the Prefab tab.

  2. Set Player simulation type to Hybrid DOTS in the Prefab tab.

  3. Make sure Player simulation type is set to Hybrid DOTS in the player car settings (make sure that config on the subscene has the same value).

  4. Create a vehicle using the Car Prefab Creator tool.

  5. Create prefab variant from the PlayerCarSkinBase prefab & assign to Player Car Pool according to the vehicle.

  6. Customize the car slots in the created prefab if you plan to make the NPC’s shooting option from the car [optional step].

  7. Once all the steps have been completed, reimport subscene.

Hybrid Mono (experimental)

How To Create

  1. Open the Car Prefab Creator & set Car type to Player in the Prefab tab.

  2. Set Player simulation type to Hybrid mono in the Prefab tab.

  3. Set the Hybrid mono in the Player car settings config (make sure that config on the subscene has the same value).

  4. Drag & drop your desired prefabs into the Prefabs field.

  5. Click the Scan button.

  6. Customize Save settings in the Save tab.

  7. In the Prefab Info tab, enter the vehicle ids (ids should match the traffic cars ids if you want to make option enter & exit for the player npc).

  8. Click the Create button.

  9. Ensure that the bounds of the entities created match the prefabs you have selected.

  10. Input for the player vehicle is implemented according to your vehicle controller plugin.

  11. The input enable & disable for the car when the player’s npc exits & enters the car should be implemented in the PlayerInteractCarService.cs in the EnterCar & ExitCar methods.

  12. Once all the steps have been completed, reimport subscene.

Player Car Pool

Where To Find

In the scene:

Hub/Pools/Car/PlayerCarPool

_images/PlayerCarPool.png

How To Use

Player cars spawned by PlayerCarSpawner.

Example

_images/PlayerCarPoolExample.png