class MeshBlock (Niantic.ARDK.AR.Mesh.MeshBlock)

Overview

A cube-shaped portion of the mesh of the environment. More…

class MeshBlock {
public:
    // fields

    UnityEngine.Mesh Mesh;
    NativeArray<Vector3> Normals;
    NativeArray<int> Triangles;
    NativeArray<Vector3> Vertices;

    // properties

    int ColliderVersion;
    int MeshVersion;
    int Version;
};

Detailed Documentation

A cube-shaped portion of the mesh of the environment.

Fields

UnityEngine.Mesh Mesh

The Unity mesh created from the Vertices, Normals, and Triangles data. This value will be null until set by a consumer of the MeshBlocks provided by IARSession.Mesh, such as the ARMeshManager component.

NativeArray<Vector3> Normals

The normals associated with this mesh block, sharing indices with the Vertices array. It is valid when the Vertices array is valid, see that variable’s comments for details.

NativeArray<int> Triangles

The triangle indices associated with this mesh block. Each triple of values are 3 indices into the Vertices/Normals arrays defining a triangle. It is valid when the Vertices array is valid, see that variable’s comments for details.

NativeArray<Vector3> Vertices

The vertices associated with this mesh block. This array will only be valid until the next frame when the _MeshDataParser updates, when this value will also be updated to once again point to a valid array. If the mesh as a whole updated but this block didn’t, then there won’t be an associated _MeshBlockParser.MeshBlockUpdated call but this value will still update to point to a valid array with the same contents. It is strongly recommended never to store these values, and always access them through the MeshBlock. If you do need access to old values you need to create a managed copy of the array. If the _MeshDataParser is not configured to provide block data, or if it has been Disposed, this will be a default NativeArray whose IsCreated property will be false.

Properties

int ColliderVersion

The last version that this block had its collider updated at. Not set by the provider, besides to leave it at -1 initially. The consumer then uses this to track their own work.

int MeshVersion

The last version of the mesh that this block was part of. Used to remove obsolete blocks.

int Version

The last version that this block was updated at.