Workshop.codes
Create

Snap Object To Grid Last updated October 29, 2025

Description

Moves a previously spawned static object to the nearest position on a uniform world grid of a specified cell size, rounding each axis independently. Useful for enforcing aligned placement in map editor modes, ensuring objects sit flush against each other, or implementing a snap-to-grid toggle for player-placed objects.

Snippet

Snap Object To Grid(Last Created Object, 1);

Properties

Returns: Void
Parameters: Object, Grid Size

Object
Type: Object, Default: Last Created Object
The static object to snap to the grid.

Grid Size
Type: Number, Default: 1
The size of each grid cell in meters. The object's position is rounded to the nearest multiple of this value on all axes.

Workshop.codes