HomeGuides
HomeGuidesLearn about the Immerse SDK installerLog In

A Snapper component is what 'snaps' to a Snap Target. This is typically done by grabbing an object by it's Handle and releasing it near the Snap Target, however it is also possible to snap via code too.

465465

Snapper component as it appears in the Inspector

Description
HandlesHandles attached to this object. When one of these handles is disengaged, the Snapper will attempt to snap to the available target.
Start Position(Optional) The snap target this should start on.
Fallback Snap TargetsThese snap targets will always be considered when snapping.
On SnapEvent triggered when the Snapper snaps to a SnapTarget
On UnsnapEvent triggered when the Snapper unsnaps from a SnapTarget

Snapping via Code

As stated above, it is possible to snap a Snapper to a Snap Target via code.

snapper.Snap(snapTarget);

// Snap ignoring requirements (force snap)
snapper.Snap(snapTarget, true);

This method can also be called from the Snap Target, with the Snapper as the parameter.

snapTarget.Snap(snapper);

// Snap ignoring requirements (force snap)
snapTarget.Snap(snapper, true);

Related pages