# SetSpriteShapeBox

## Description

Overrides the current auto generated shape for use in collision detection, hit testing, and physics. A shape can be set without turning physics on, and by default all sprites are set to use the box shape, which is the fastest to setup. The box is defined by specifying its top left and bottom right coordinates in sprite space, relative to the offset of the sprite, by default this is the center of the sprite. For example if the current sprite offset was 0,0 the top left box corner would be 0,0, but if the sprite offset was the middle of the sprite (default) the top left corner would be -width/2,-height/2. You may also specify an angle to offset the box relative to the current sprite rotation.
Setting a shape removes all other shapes assigned to the sprite and replaces it with this one.

## Definition

SetSpriteShapeBox( iSpriteIndex, x, y, x2, y2, angle )

void agk::SetSpriteShapeBox( UINT iSpriteIndex, float x, float y, float x2, float y2, float angle )

## Parameters

- iSpriteIndex - The ID of the sprite to modify.
- x - The x coordinate of the top left corner of the new box in sprite space.
- y - The y coordinate of the top left corner of the new box in sprite space.
- x2 - The x coordinate of the bottom right corner of the new box in sprite space.
- y2 - The x coordinate of the bottom right corner of the new box in sprite space.
- angle - The angle of the box in radians.