Skip to content

Point cloud Clash Detection

In order to validate if a piece of equipment can fit in an existing building, point cloud clash detection might be a handy feature. It will allow you to highlight any clashes - i.e. two objects that are interfering - between point cloud and 3D meshes.

PointCloudMeshCollider

Right click on a point cloud in the hierarchy window. Go to Stipple > Check Collision and click on it.

Check collision

Your point cloud should now have a "Point Cloud Collision Scene" component attached to it. Which means it can now detect when a collision happens.

PointCloudCollisionScene Component

  • Resolution: Resolution is in meters, and will indicate the precision of clash computation. This can be quite memory intensive, so be careful not to overload computer's memory by setting this setting too low. This resolution will be applied for the whole scene, so it might be adjusted for point cloud that cover a large span area.

  • Minimum point intersected before triggering a collision event. When your point cloud is noisy, triggering a collision event every time a point is intersected might be too sensitive. You can set this value to act as a threshold.

Next add a Point Cloud Mesh Collider component to the meshes we want to test collisions against. Ensure the GameObject has a Mesh Collider component attached to it.

PointCloudMeshCollider

When the mesh intersects with another point cloud during play mode the "Intersects" field of the PointCloudMeshCollider component will be set to true.

Pcl collision is true

Collisions will not work on this mesh

If you encounter the following error Read/write is disabled for YourGameObject. Collisions will not work on this mesh, double-check that your model has the Read/Write flag enabled on your Model tab.

Callbacks

PointCloudMeshCollider allows you to get notified when the mesh collides with a point cloud allowing you to trigger events when this happens.

IntersectTriggerOn

Called when the mesh starts colliding with a point cloud.

IntersectTriggerOff

Called when the mesh stops colliding with a point cloud.

Usage Example

[RequireComponent(typeof(PointCloudMeshCollider))]
public class MyCollisionHandler : MonoBehaviour
{
    private PointCloudMeshCollider meshCollider;

    private void OnEnable()
    {
        meshCollider = GetComponent<PointCloudMeshCollider>();
        meshCollider.IntersectTriggerOn += TriggerOn;
        meshCollider.IntersectTriggerOff += TriggerOff;
    }

    private void OnDisable()
    {
        meshCollider.IntersectTriggerOn -= TriggerOn;
        meshCollider.IntersectTriggerOff -= TriggerOff;
    }

    private void TriggerOn()
    {
        Debug.Log("Start intersecting with point cloud.");
    }

    private void TriggerOff()
    {
        Debug.Log("Stop intersecting with point cloud.");
    }
}