bbi.spawn¶
- class Asset(node_id: str, asset_name: str, position: Vector3 = Vector3.zero(), rotation: Vector3 = Vector3.zero(), scale: Vector3 = Vector3(1, 1, 1))¶
Bases:
Node
,Animatable
[AssetUpdateParam
]Asset class which holds the 3D model data and information.
- Parameters:
node_id (str) – The user defined unique ID.
asset_name (str, optional) – The name of the asset.
position (Vector3, optional) – The position of the asset. Defaults to Vector3.zero().
rotation (Vector3, optional) – The rotation of the asset. Defaults to Vector3.zero().
scale (Vector3, optional) – The scale of the asset. Defaults to Vector3(1, 1, 1).
- property centroid_offset: Vector3¶
The offset to add to the asset position to get the centroid of the asset.
- property asset_name: str¶
- property annotate: bool¶
- set_transform(transform: Transform) None ¶
Set the transform of the instance. For efficiency, this method is preferred over setting individual transform components.
- Parameters:
transform (Transform) – The transform.
- set_annotate(annotate: bool) None ¶
Set the annotation status of the asset.
- Parameters:
annotate (bool) – Whether to annotate the asset. If this is set to
False
, the asset will not show up in annotations, which helps to reduce overall computation time in rendering and downloading.
- get_collisions() set[str] ¶
Get the names of all assets that collide with the current asset.
- attach_to(parent: Node, rule: TransformAttachmentRule = TransformAttachmentRule.KEEP_WORLD) None ¶
Attach the asset to another node inheriting its transform operations.
- Parameters:
parent (Node) – The parent node to attach the asset to.
rule (TransformAttachmentRule, optional) – How to handle transforms and welding when attaching, defaults to TransformAttachmentRule.KEEP_WORLD.
- attach_to_root() None ¶
Attach the asset to its root node.
- execute(frame_id: int | None = None, frame_max: int | None = None, delta_seconds: float | None = None) None ¶
Update the asset state up to the specified frame.
- Parameters:
frame_id (int | None, optional) – The frame ID. Defaults to None.
frame_max (int | None, optional) – Max frame count in the current loop Defaults to None.
delta_seconds (float | None, optional) – The target real-time in seconds between frames. This is used to calculate physical displacement for certain assets. Defaults to None.
- enable_wake(is_enabled: bool) None ¶
Enables or disables the wake effect on the asset.
- Parameters:
is_enabled (bool) – Whether to enable or disable the wake effect.
- set_collision_check(check: bool) None ¶
Whether the asset should be included in collision checks.
When enabled, this asset will be considered during collision detection with other assets being added or moved in the spatial index. When disabled, this asset will be ignored during such checks.
- Parameters:
check (bool) – Whether to perform collision checks for this asset.
- set_thermal_brightness(value: float) None ¶
Set the thermal brightness of the asset.
A value of 0 represents the darkest thermal state, while a value of 1 represents the brightest thermal state.
- Parameters:
value (float) – The thermal brightness value between 0 and 1
- set_thermal_color_variation(value: float) None ¶
Set the thermal color variation of the asset.
A value of 0 represents no color variation, while a value of 1 represents maximum color variation.
- Parameters:
value (float) – The thermal color variation value between 0 and 1
- set_thermal_opacity(value: float) None ¶
Set the thermal opacity of the asset.
A value of 0 represents completely transparent, while a value of 1 represents completely opaque.
- Parameters:
value (float) – The thermal opacity value between 0 and 1
- set_thermal_glass_brightness(value: float) None ¶
Set the thermal glass brightness of the asset.
A value of 0 represents the darkest glass brightness state, while a value of 1 represents the brightest glass brightness state.
- Parameters:
value (float) – The thermal glass brightness value between 0 and 1
- pydantic model SpawnZoneUpdateParam¶
Bases:
AnimationFrame
- Validators:
check_names_and_weights
»all fields
set_default_weights
»all fields
- field asset_names: list[str] | None = None¶
- Validated by:
- field asset_weights: list[float] | None = None¶
- Validated by:
- field contain_within: bool | None = None¶
- Validated by:
- field force_respawn: bool | None = None¶
- Validated by:
- field jitter_z: tuple[float, float] | None = None¶
- Validated by:
- field pitch_range: tuple[float, float] | None = None¶
- Validated by:
- field quantity: Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Ge(ge=0)])] | None = None¶
- Validated by:
- field roll_range: tuple[float, float] | None = None¶
- Validated by:
- field use_geom_rotation: bool | None = None¶
- Validated by:
- field yaw_range: tuple[float, float] | None = None¶
- Validated by:
- validator check_names_and_weights » all fields¶
- validator set_default_weights » all fields¶
- class SpawnZone(node_id: str, asset_names: list[str], quantity: int, geometry: Geometry | list[Geometry], asset_type: type[Asset] = Asset, yaw_range: tuple[float, float] = (0, 360), pitch_range: tuple[float, float] = (0, 0), roll_range: tuple[float, float] = (0, 0), asset_weights: list[float] | None = None, force_respawn: bool = False, contain_within: bool = True, jitter_z: tuple[float, float] = (0, 0), use_geom_rotation: bool = True)¶
Bases:
Node
,Animatable
[SpawnZoneUpdateParam
]Random scattering of assets within a defined zone.
- Parameters:
node_id (str) – The node ID of the zone.
asset_names (list[str]) – The names of the assets to spawn.
quantity (int) – The max number of objects to spawn. The final number of spawned assets might be less than this number if there are not enough valid spawn locations, most often due to collisions.
geometry (Geometry, list[Geometry]) – The geometry that defines the spawn zone.
asset_type (type[Asset], optional) – The type of asset to spawn. Defaults to Asset.
yaw_range (tuple[float, float], optional) – The yaw range for the assets. Defaults to (0, 360). If the geometry is a Spline, the yaw would be set to the tangent of the spline at the spawn position, unless use_geom_rotation is set to False.
roll_range (tuple[float, float], optional) – The roll range for the assets. Defaults to (0, 0). This has no effect on BuoyantAsset.
pitch_range (tuple[float, float], optional) – The pitch range for the assets. Defaults to (0, 0). If the geometry is a Spline, the pitch would be set to the normal of the spline at the spawn position. This has no effect on BuoyantAsset.
asset_weights (list[float], optional) – The distribution of assets when spawning. If not provided, all assets are equally likely to be spawned.
force_respawn (bool, optional) – Forcibly remove all existing assets and spawn new ones at each frame, even if the SpawnZone parameters have not changed. If SpawnZone parameters are changed, assets are always respawned regardless of the value of force_respawn. Defaults to False.
contain_within (bool, optional) – Make assets spawn contained entirely within the geometry (Polygon or Cuboid). If True, assets will not clip the edges of the boundary. If False, assets may extend beyond the boundary. Defaults to True.
jitter_z (tuple[float, float], optional) – The range of z-axis jitter applied to the assets after they are spawned. Defaults to (0, 0).
use_geom_rotation (bool, optional) – Whether to use the intrinsic rotation of the geometry (e.g. Spline). Defaults to True.
- execute(frame_id: int | None = None, frame_max: int | None = None, delta_seconds: float | None = None) None ¶
Update the spawnzone state up to the specified frame.
- Parameters:
frame_id (int | None, optional) – The frame ID. Defaults to None.
frame_max (int | None, optional) – Max frame count in the current loop. Defaults to None.
delta_seconds (float | None, optional) – The target real-time in seconds between frames. This is used to calculate physical displacement for certain assets. Defaults to None.
- pre_execute(frame_id: int | None = None, frame_max: int | None = None, delta_seconds: float | None = None) None ¶
Removes spawned assets if respawning is needed. This is to ensure that the old assets are not present during collision checks, especially in the case where there are multiple SpawnZones and they overlap
- Parameters:
frame_id (int | None, optional) – The frame ID. Defaults to None.
frame_max (int | None, optional) – Max frame count in the current loop. Defaults to None.
delta_seconds (float | None, optional) – The target real-time in seconds between frames. This is used to calculate physical displacement for certain assets. Defaults to None.
- pydantic model BuoyantAssetUpdateParam¶
Bases:
AssetUpdateParam
- Validators:
_validate_rotation
»rotation
- field sinking_offset: float | None = None¶
- class BuoyantAsset(node_id: str, asset_name: str, position: Vector3 = Vector3.zero(), rotation: Vector3 = Vector3.zero(), scale: Vector3 = Vector3(1, 1, 1))¶
Bases:
Asset
,Animatable
[BuoyantAssetUpdateParam
]Assets which floats on water and has a buoyant physics effect.
- set_transform(transform: Transform) None ¶
Set the transform of the instance. For efficiency, this method is preferred over setting individual transform components.
- Parameters:
transform (Transform) – The transform.
- set_sinking_offset(sinking_offset: float) None ¶
Set the sinking offset for the buoyant asset.
- Parameters:
sinking_offset (float) – The offset value (in meters) for the sinking effect.
- set_buoyancy_damping(damping: float) None ¶
Set the buoyancy damping of the buoyant asset.
- Parameters:
damping (float) – The rate at which rotation should chase buoyancy. A value of 1.0 means that the asset will be as buoyant as the ocean, and a value of 0.0 means that the asset will have no buoyancy at all.
- execute(frame_id: int | None = None, frame_max: int | None = None, delta_seconds: float | None = None) None ¶
Update the asset state up to the specified frame.
- Parameters:
frame_id (int | None, optional) – The frame ID. Defaults to None.
frame_max (int | None, optional) – Max frame count in the current loop Defaults to None.
delta_seconds (float | None, optional) – The target real-time in seconds between frames. This is used to calculate physical displacement for certain assets. Defaults to None.