Skip to content

Latest commit

 

History

History
251 lines (172 loc) · 10.1 KB

carPrefabCreator.rst

File metadata and controls

251 lines (172 loc) · 10.1 KB

Car Prefab Creator =====

Youtube tutorial.

How To Use

  1. From the Unity toolbar, open Car Prefab Creator.

    Spirit604/CityEditor/Car Prefab Creator

    image

  2. Drag & drop source cars from scene or project to Prefabs field depends on Prefab Source Type parameter.

    image

  3. Configure the Common settings <carPrefabCreatorCommonSettings> for creating a car.

    image

  4. If the vehicle is the Simple vehicle <simplePhysicsVehicle> type, enable Add wheel offset in the Common settings <carPrefabCreatorCommonSettings> tab.

    image

    Custom physics entity <customPhysicsVehicle> shape result example

    image

    Simple physics entity <simplePhysicsVehicle> shape result example

  5. Configure the Save settings <carPrefabCreatorSaveSettings> for creating a car.

    image

  6. Change the Template settings <carPrefabCreatorTemplateSettings> depending on the name of the car body (if it is a child) and the pattern of the names of the wheels.
  7. Click Scan button.
  8. Open Additional Settings <carPrefabCreatorAdditionalSettings> tab, adjust common settings for all vehicles.

    image

  9. After, open Prefab Info <carPrefabCreatorPrefabInfo> tab, adjust unique settings for each vehicle.

    image

  10. Once all the settings have been customised, click Create to create the prefabs.

Prefab Settings

image

Prefab source type:
  • Scene
    • Targets prefab parent : prefabs will be taken from the selected root from the scene.
  • Project
    • Prefabs : selected prefabs from the project.
Car type:
  • Traffic : prefab car will be created for the traffic.
  • Player : prefab car will be created for the player.
Cache container : cache data of saved vehicles.
Vehicle data collection : reference to the collection <vehicleCollection> of all vehicles.
Traffic car convert template : template which contains traffic prefab template.
Player car convert template : template which contains player prefab template.

Common Settings

image

Assign hull mesh: should find the hull of the car.
  • Parent is hull mesh : car root contains a car mesh.
Fit physics shape to mesh : physical shape will be resized to the mesh size.
Has wheels : should search for wheels on a template <carPrefabCreatorTemplateSettings>.
Has navmesh obstacle: does the car contain NavMeshObstacle component.
  • Move threshold
  • Carve stationary
  • Carve time to stationary
Add offset: offset of the vehicle hull along the Y axis.
  • Fix pivot : fixes the pivot point if the pivot point is in the centre of the mesh.
  • Add wheel offset : adds wheel offset size.
  • Local offset : custom offset value.

Save Settings

image

Save to exist preset:
  • Scene: add the created prefabs to an existing preset <trafficPreset> in the scene.
  • Selected: add the created prefabs to selected preset <trafficPreset>.
New preset settings:
  • Assign new preset to scene : preset <trafficPreset> will replace an existing preset <trafficPreset> on scene.
  • New preset path : project path where to create a new preset <trafficPreset>.
  • New preset name : new preset <trafficPreset> name.
Entity type : entity type of the vehicle <trafficCarSettings>.
Prefab save type:
  • Override source : selected prefabs will be replaced by new ones.
  • Create new if not exist : new prefabs will be created only if there are no previously created ones by the selected path.
  • Override target : previously created prefabs will be overwritten in case of a duplicate.
Prefab save path type:
  • Original prefab path : prefabs will be created in the directory where the selected prefabs are located.
  • Template prefab path : Prefabs will be created in the directory where the template is located.
  • Custom path : user's path of creation.
New prefab template name : pattern of the name of the created prefab (for instance Car1 (source name) + "_new" (pattern) = Car1_new).
Collection edit type:
  • Add to exist : add vehicles to exist vehicle collection <vehicleCollection>.
  • Override : overrides vehicle collection <vehicleCollection> by created vehicles.
Material type:
  • Source : material is copied from the source prefab.
  • Custom atlas material : user's custom atlas material.
  • New unique material : new material is generated based on the user's own material.

Template Settings ----------------

image

Hull name templates : keyword phrases for automatic hull searches.
Wheel name templates : keyword phrases for automatic wheels searches.
  • Wheel FR : forward right wheel.
  • Wheel FL : forward left wheel.
  • Wheel BR : backward right wheel.
  • Wheel BL : backward left wheel.
  • Wheel Middle : additional wheels.

Preview Settings

image

Show preview : on/off preview image of the prefab on the Prefab Info tab.
Show additional settings : on/off display of the additional settings of the prefab on the Prefab Info tab.
Show custom settings : on/off display of the custom settings of the prefab on the Prefab Info tab.

Additional Settings ----------------

Common Settings ~~~~~~~~~~~~

image

Wheel radius : wheel radius.
Wheel offset : wheel offset by Y-axis of the vehicle.
Suspension length : suspension length of the vehicle. [Custom physics vehicles only]

Note

* Editing additional parameters will affect all cars in the Prefab Info <carPrefabCreatorPrefabInfo> tab, to make unique parameters check the toolbox opposite on the parameter in the Prefab Info <carPrefabCreatorPrefabInfo>. * Arrow-button applies the setting for the selected parameter.

Physics

image

Size offset : size offset of physics shape.
Center offset : center offset of physics shape.
Center of mass : center of mass of the vehicle.
Bevel radius : bevel radius of physics shape.
Mass : mass of the vehicle.

Info Tab

image

Graphics

image

Wheel source type:
  • Model unique : the wheels remain as in the original model.
  • Shared from model : the wheel model selected by the user from the original model is used for all wheels.
  • Shared all : the wheel model selected by the user shared between all wheels.
Wheel rotation type [shared wheel only]:
  • Source : the wheel rotation remains unchanged.
  • Flip left row : rotate the wheel in the left-hand row by 180° if you are using the wheel model from the right-hand row.
  • Flip right row : rotate the wheel in the right-hand row by 180° if you are using the wheel model from the left-hand row.
Has lods: on/off LODs for vehicle.
  • Lod 0, 1, 2 screen size : screen size of LOD.

Note

Wheel sharing is useful for using the same wheel model for all wheels to reduce drawcalls.

Info Tab

image

Prefab Info

image

Car Info

  • Prefab : reference to source prefab.
  • Name : user's name <carModel> of the vehicle.
  • ID : new ID <trafficId> entry for vehicle collection <vehicleCollection>.
  • Traffic group : traffic group <pathTrafficGroup> of the vehicle.
  • Override entity type : new entity type <trafficCarSettings> for selected vehicle (might be useful for specific vehicles such as tram).
    • Entity type
  • Public transport : on/off public transport <trafficPublic> feature. (Settings <trafficPublicAuthoring>)
    • Predefined road
    • Capacity
    • Entries
  • Settings type:
    • New : user-defined settings.
    • Template : vehicle settings are copied from the selected template [custom physics vehicle only].
    • Clone model : vehicle settings are copied from the selected CarModel in the list.
  • Wheel radius : wheel radius. (can be unique value)
  • Wheel offset : wheel offset by Y-axis of the vehicle. (can be unique value)
  • Suspension length : suspension length of the vehicle. (can be unique value) [Custom physics vehicles only]

Buttons

image

Scan : scan the added prefabs and add information about new ones to the Prefab Info tab.
Create : create new entity prefabs based on the added prefabs.