Object bounds

Object bounds represent the volume that an entity and its children occupy. In Azure Remote Rendering, object bounds are always given as axis aligned bounding boxes (AABB). Object bounds can be either in local space or in world space. Either way, they are always axis-aligned, which means the extents and volume may differ between the local and world space representation.

Querying object bounds

The local axis aligned bounding box of a mesh can be queried directly from the mesh resource. These bounds can be transformed into the local space or world space of an entity using the entity's transform.

It's possible to compute the bounds of an entire object hierarchy this way, but that requires to traverse the hierarchy, query the bounds for each mesh, and combine them manually. This operation is both tedious and inefficient.

A better way is to call QueryLocalBoundsAsync or QueryWorldBoundsAsync on an entity. The computation is then offloaded to the server and returned with minimal delay.

public async void GetBounds(Entity entity)
{
    try
    {
        Task<Bounds> boundsQuery = entity.QueryWorldBoundsAsync();
        Bounds result = await boundsQuery;
    
        Double3 aabbMin = result.Min;
        Double3 aabbMax = result.Max;
        // ...
    }
    catch (RRException ex)
    {
    }
}
void GetBounds(ApiHandle<Entity> entity)
{
    entity->QueryWorldBoundsAsync(
        // completion callback:
        [](Status status, Bounds bounds)
        {
           if (status == Status::OK)
            {
                Double3 aabbMin = bounds.Min;
                Double3 aabbMax = bounds.Max;
                // ...
            }
        }
    );
}

API documentation

Next steps