 			}
 			value = value < min ? value : min;
 			return value > max ? value : max;
+		}
+		
+		/**
+		 * Clamps the object inside the rectangle.
+		 * @param	object		The object to clamp (must have an x and y property).
+		 * @param	x			Rectangle's x.
+		 * @param	y			Rectangle's y.
+		 * @param	width		Rectangle's width.
+		 * @param	height		Rectangle's height.
+		 */
+		public static function clampInRect(object:Object, x:Number, y:Number, width:Number, height:Number, padding:Number):void
+		{
+			object.x = clamp(object.x, x + padding, x + width - padding);
+			object.y = clamp(object.y, y + padding, y + height - padding);
 		}
 		
 		/**

		public static var camera:Point = new Point;
		
		/**
		 * The currently active World object. When you set this, the World is flagged
		 * to switch, but won't actually do so until the end of the current frame.
		 */

		 * @param	object		The object whose x/y properties should be set.
		 * @param	angle		The angle of the vector, in degrees.
		 * @param	length		The distance to the vector from (0, 0).
		 * @param	x			X offset.
		 * @param	y			Y offset.
		 */
		public static function angleXY(object:Object, angle:Number, length:Number = 1, x:Number = 0, y:Number = 0):void
		{
			angle *= RAD;
			object.x = Math.cos(angle) * length + x;
			object.y = Math.sin(angle) * length + y;
		}
		
		/**
		 * Rotates the object around the anchor by the specified amount.
		 * @param	object		Object to rotate around the anchor.
		 * @param	anchor		Anchor to rotate around.
		 * @param	angle		The amount of degrees to rotate by.
		 */
		public static function rotateAround(object:Object, anchor:Object, angle:Number = 0, relative:Boolean = true):void
		{
			if (relative) angle += FP.angle(anchor.x, anchor.y, object.x, object.y);
			FP.angleXY(object, angle, FP.distance(anchor.x, anchor.y, object.x, object.y), anchor.x, anchor.y);
		}
		
		/**
