> For the complete documentation index, see [llms.txt](https://teogames.gitbook.io/dynamic-mesh-combiner/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://teogames.gitbook.io/dynamic-mesh-combiner/components/mc-extractor.md).

# MC Extractor

## Overview

The MC Extractor component allows you to extract and bake all `MC Combinable` instances from a provided object. It offers various features such as scaling the output mesh along the normal (useful for highlighting objects), rendering a specific percentage of meshes (e.g., for showing a construction process), and extracting meshes with overridden materials (e.g., transparent holograms or custom shaders). The component provides configuration options to customize its behavior.

## Features

The MC Extractor component provides the following features:

* **Scale Output Mesh Along Normal:** Enables scaling the output mesh along the normal direction, which can be useful for highlighting objects.
* **Render 0-100% of Meshes:** Allows rendering a specified percentage of the extracted meshes, facilitating dynamic visualization (e.g., showing a construction process step by step).
* **Extract Meshes with Overridden Material:** Supports extracting meshes with overridden materials, such as transparent holograms or meshes using custom shaders.
* **Show By Default:** When enabled, all extracted meshes are shown at the start.
* **Use Relative Scale:** When enabled, each mesh's individual scale is used to scale the mesh instead of a global scale. This can be useful when outlining objects with different scales.
* **Async Mode:** When enabled, the extraction process runs asynchronously, utilizing up to 10ms per frame. Async mode is recommended when speed is not a critical factor.
* **Global Material:** If set, the global material will override all materials of the extracted meshes.

## Public Methods

The MC Extractor component provides the following public methods for script usage:

### `void Clean()`

This method cleans up the extracted meshes, removing any previously extracted meshes from the scene.

### `void Show(int id)`

Shows the mesh with the specified `id`. The mesh becomes visible in the scene.

### `void ShowAll()`

Shows all extracted meshes, making them visible in the scene.

### `void Hide(int id)`

Hides the mesh with the specified `id`. The mesh becomes invisible in the scene.

### `void HideAll()`

Hides all extracted meshes, making them invisible in the scene.

### `bool IsValidCombinable(Combinable combinable)`

Checks if a given `Combinable` instance is a valid combinable mesh that can be extracted by the MC Extractor. Returns `true` if the combinable is valid; otherwise, returns `false`.

### `Task Build(Transform original)`

Starts the asynchronous process of building the extracted meshes based on the provided `original` transform. Returns a `Task` that can be awaited to track the completion of the build operation.

### `Task Build(Transform original, Vector3 offset, Vector3 rotation, float scale)`

An overloaded version of the `Build` method that allows you to specify additional offset, rotation, and scale parameters to modify the extracted meshes' placement and size. Returns a `Task` that can be awaited.

The MC Extractor component and its associated public methods offer control and flexibility for managing the extraction and visibility of meshes in your scripts.
