> For the complete documentation index, see [llms.txt](https://mrcmodding.gitbook.io/arma-3-object-builder/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mrcmodding.gitbook.io/arma-3-object-builder/tools/hit-point-cloud.md).

# Hit Point Cloud

{% embed url="<https://youtu.be/P21DAzbKdD8>" %}

## Tool panel

<figure><img src="/files/gPLfSD4OSPqzLs4NwSGp" alt="Hit point cloud generator tool panel"><figcaption></figcaption></figure>

### Location

**Object Builder** tab in the 3D viewport sidebar.

### Properties

* Source: mesh object to use as boundary geometry for point cloud creation
* Target (optional): mesh object to update with generated point cloud (new object is created if not set)
* Spacing X,Y,Z: space between the generated points in the three axis directions
* Bevel:
  * Offset: offset value of the bevel applied to the source object during generation
  * Segments: number of segments of the bevel applied to the source object during generation
  * Triangulate:
    * Before: triangulate the mesh before applying the bevel
    * After: triangulate the mesh after applying the bevel
* Selection: vertex group to add the generated points to

***

## Process

### Preprocess

The algorithm used for filtering out the unneeded points is prone to create false positives on low poly models with sharp angles. To solve this issue, a bevel modifier and a triangulate modifier is temporarily applied to the source object. The applied bevel modifier can be slightly customised to avoid getting false negatives along edges due to a too large bevel offset.

<figure><img src="/files/YfZxJrxrfsJ8we3QOPgo" alt="False positive inside points with low poly source mesh"><figcaption></figcaption></figure>

To further decrease the probability of false positives, a triangulate modifier is also applied either before, or after the bevel modifier (the order of the modifiers is only significant when using a source mesh with greatly distorted ngon faces.

Reason for false positives:

On low poly meshes when the algorithm checks for the closest point on the mesh to the point being tested, it may produce a singular result when the closest point is on an edge, instead of a face.

### Point grid

1. 2 characteristic points of the source object's bounding box are identified (most negative and most positive)
2. possible point count is calculated in the 3 axis directions based on the bounding box dimensions and the set spacing
3. grid row positions are generated in the 3 axis directions based on the calculated counts (when the resulting grid is smaller in one or more directions than the dimensions of the source object, the grid is centered with equal padding on all sides).

The grid coordinates are calculated in the local object coordinate system of the source object, so the object can be rotated and offset to any position in world space (the scaling is not taken into consideration, so the scale should be applied before generating the points).

<figure><img src="/files/svKytIJ2oQ31gxjUiJxs" alt="Grid generated in local object coordinates"><figcaption></figcaption></figure>

### Filtering

Every point of the calculated grid is tested for being inside or outside of the preprocessed source mesh. The points outside are discarded, and the points inside are added to the resulting mesh data. The filtering is done by the algorithm proposed by [Salai Vedha Viradhan](https://salaivv.com/2023/04/12/point-inside-outside). Since the algorithm is based on face normals, the source object should be manifold, and free of degenerate faces.

The algorithm supports any source shape (including ones with holes), as long as it's manifold.

<figure><img src="/files/CIXWS3WXAqhTmzJX5Lym" alt="Points generated from a source shape with hole"><figcaption></figcaption></figure>

### Output

The resulting mesh point data is placed into the traget object or if not set, into a newly created object. The result object inherits the position, rotation and scale of the source object.

Finally, if the selection property is set, a new vertex group is created and the points are assigned to it.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://mrcmodding.gitbook.io/arma-3-object-builder/tools/hit-point-cloud.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
