public void Snap() { CheckForPositionChanges(); snappedPoint = position; snappedPointSet = true; snappedPoint.LocalX = System.Math.Floor(snappedPoint.LocalX); snappedPoint.LocalY = System.Math.Floor(snappedPoint.LocalY); snappedPoint.LocalZ = System.Math.Floor(snappedPoint.LocalZ); var oldPosition = transform.position; UpdatePositionNow(); var newPosition = transform.position; var delta = newPosition - oldPosition; if (OnSnap != null) { OnSnap(this, delta); } SgtHelper.InvokeSnap(delta); }