<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [server](./server.md) &gt; [ChunkLattice](./server.chunklattice.md) &gt; [setBlock](./server.chunklattice.setblock.md)

## ChunkLattice.setBlock() method

Sets the block at a global coordinate by block type ID.

Use for: incremental terrain edits. Do NOT use for: bulk terrain loading; use `ChunkLattice.initializeBlocks`<!-- -->.

**Signature:**

```typescript
setBlock(globalCoordinate: Vector3Like, blockTypeId: number, blockRotation?: BlockRotation): void;
```

## Parameters

<table><thead><tr><th>

Parameter


</th><th>

Type


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

globalCoordinate


</td><td>

[Vector3Like](./server.vector3like.md)


</td><td>

The global coordinate of the block to set.


</td></tr>
<tr><td>

blockTypeId


</td><td>

number


</td><td>

The block type ID to set. Use 0 to remove the block and replace with air.


</td></tr>
<tr><td>

blockRotation


</td><td>

[BlockRotation](./server.blockrotation.md)


</td><td>

_(Optional)_ The rotation of the block.

\*\*Side effects:\*\* Emits `ChunkLatticeEvent.SET_BLOCK` and mutates block colliders.

\*\*Category:\*\* Blocks


</td></tr>
</tbody></table>
**Returns:**

void

## Remarks

\*\*Air:\*\* Use block type ID `0` to remove a block (set to air).

\*\*Collider updates:\*\* For voxel block types, updates the existing collider. For trimesh block types, recreates the entire collider.

\*\*Removes previous:\*\* If replacing an existing block, removes it from its collider first. If the previous block type has no remaining blocks, its collider is removed from simulation.

