Point clouds
This page is a supplement to the AR Foundation Point clouds manual. The following sections only contain information about APIs where ARCore exhibits unique platform-specific behavior.
Tip
When developing an AR app, refer to both the AR Foundation documentation as well as the required packages for each platform you support.
ARCore's point cloud subsystem only produces one XRPointCloud.
When you use the raycast subsystem to cast a ray at a point in the cloud, the returned pose orientation provides an estimate for the surface that point might represent.
Native pointer
XRPointCloud.nativePtr values returned by this package contain a pointer to the following struct:
typedef struct UnityXRNativePointCloud
{
int version;
void* pointCloud;
} UnityXRNativePointCloud;
This package also provides a header file containing the definitions of various native data structs including UnityXRNativePointCloud
. It can be found in the package directory under Includes~/UnityXRNativePtrs.h
.
Cast void* pointCloud
to an ArPointCloud handle in C++ using the following example code:
// Marhshal the native point cloud data from the XRPointCloud.nativePtr in C#
UnityXRNativePointCloud nativePointCloudData;
ArPointCloud* pointCloudHandle = static_cast<ArPointCloud*>(nativePointCloudData.pointCloud);
To learn more about native pointers and their usage, refer to Extending AR Foundation.