Insert new assets

Note

This guide demonstrates inserting new assets manually into the world using Asset and its subclasses.

If you want to scatter many assets at once, see Scatter assets randomly.

Warning

To ensure the scene is performant and renderable, there is an asset budget of 50 unique assets in the World. Adding more than 50 unique assets may result in unexpected issues.

Browsing the asset library

Click on Asset on the bottom drawer to access the asset library.

You can browse the asset library by scrolling through the list of assets or using the search bar. Click on one or more assets to select them. Assets can be selected across categories.

Once ready, click on Copy to clipboard to copy the asset names to your clipboard.

A single asset will be copied as a string, e.g. "Costa Dano", and multiple assets will be copied as a list of strings, e.g. ["Costa Dano", "Greyhound", ...].

Enlarge the window using Detailed view to view more assets at a time.

Insert a single asset

Click on an asset and click Copy to clipboard to copy its asset_name. You can use this name to define a new Asset and add it to the world, using world.add(asset).

Insert a single asset with the copied name
boat = Asset(node_id="myboat", asset_name="<COPIED ASSET NAME>")
world.add(boat)

Tip: Asset creation options

You may use the following classes to create assets with different behaviors.

bbi.Asset

Asset class which holds the 3D model data and information.

bbi.BuoyantAsset

Assets which floats on water and has a buoyant physics effect.

Insert multiple assets

Click on multiple assets and click Copy to clipboard to copy the list of names to the clipboard. Similarly, these names can be used to define and add multiple Asset instances.

Insert multiple assets with the copied names
names = ["<COPIED ASSET NAME 1>", ..., "<COPIED ASSET NAME 10>"]

for index, name in enumerate(names): # (0, name1), (1, name2), ...
    asset = Asset(
        node_id=f"myasset_{index}", # index is used to give each asset a unique node_id
        asset_name=name,
    )
    world.add(asset)

Attention: Don’t overwrite existing assets!

To add multiple different assets, remember to give the new assets different node_id values so they are treated as separate entities.

This must be done since adding an Asset with the same node_id as an existing asset will replace the existing one in the world. See /tutorials/world-hierarchy for more information.

Tip: Keep the reference to your list of assets

To refer to the assets later, store them in a list for easy access:

Store the assets in a list
names = ["<COPIED ASSET NAME 1>", ..., "<COPIED ASSET NAME 10>"]
assets: list[Asset] = []

for index, name in enumerate(names): # (0, name1), (1, name2), ...
    asset = Asset(
        node_id=f"myasset_{index}", # index is used to give each asset a unique node_id
        asset_name=name,
    )
    world.add(asset)
    assets.append(asset)

do_something(assets[0]) # Access the first asset