Skip to content

move_snap

drewmccluskey edited this page Feb 10, 2019 · 3 revisions

move_snap

Snaps the GameObject to the nearest grid cell

Syntax:

move_snap(cellSize)
Argument Description
Vector2 cellSize Grid size

Returns: void

Description:

Snaps the GameObject to the nearest specified grid cell. It is commonly used to keep objects within set positions to avoid improper collisions or for placing items to ensure they do not get stuck in another object.

Example:

move_snap(new Vector2(32,32));

The above code will snap GameObject to the nearest 32x32 grid cell.

Back to Movement

Clone this wiki locally