Clamp Actions
Clamp actions keep a Transform inside defined bounds for position or rotation.
Most clamp actions run continuously in LateUpdate by default, which helps ensure clamping is applied after other movement actions in the same frame.
Clamp Position
Use these actions to keep a Transform inside min/max position limits:
| Action | Description |
|---|---|
TransformClampPosition |
Clamps X, Y, and Z position using min/max values. |
TransformClampPosition2D |
Clamps X and Y position (2D-style bounds). |
TransformClampPositionX |
Clamps only X position. |
TransformClampPositionY |
Clamps only Y position. |
TransformClampPositionZ |
Clamps only Z position. |
Shared parameters
| Parameter | Description |
|---|---|
| Transform | The Transform to clamp. |
| Space | World or local space. |
| Min / Max values | Axis bounds used by the selected clamp action. |
Clamp Rotation
TransformClampRotation clamps rotation around one local axis.
| Parameter | Description |
|---|---|
| Transform | The Transform to clamp. |
| Rotation Axis | Local axis to constrain (X, Y, or Z). |
| Min Angle | Minimum allowed angle. |
| Max Angle | Maximum allowed angle. |
Notes
- Rotation range is relative to the parent transform (or world space if there is no parent).
- Only the selected axis is clamped. Other rotation axes are preserved.
Wrap Across Screen
TransformWrapAcrossScreen wraps a Transform across screen edges (for example, leaving left side re-enters on right side).
| Parameter | Description |
|---|---|
| Transform | The Transform to wrap. |
| Camera | Camera viewport used to determine screen bounds. |
| Wrap Left | Wrap when position exits left edge. |
| Wrap Right | Wrap when position exits right edge. |
| Wrap Top | Wrap when position exits top edge. |
| Wrap Bottom | Wrap when position exits bottom edge. |
Example
Use this for classic arcade movement:
- Add
TransformWrapAcrossScreento the moving object. - Set
Camerato your gameplay camera. - Enable all wrap directions.
- Move the object normally with your movement actions.
When the object exits one side of the screen, it appears on the opposite side.
Wrap Transforms In Sphere
WrapTransformsInSphere wraps a list of transforms inside a sphere around a center transform.
When a transform leaves the sphere radius, it is teleported to the opposite side of the sphere.
| Parameter | Description |
|---|---|
| Transforms | List of transforms to wrap. |
| Center | Center of the wrapping sphere (commonly the player, camera, or ship). |
| Radius | Radius of the wrapping sphere in world units. |
Example
Use this for 3D asteroids-style world wrapping:
- Create a
TransformListcontaining your moving objects. - Set
Centerto the player or camera transform. - Set
Radiusto your active play area radius. - Run every frame so objects that exit the sphere wrap to the opposite side.