# CreateDistanceJoint

## Description

Creates a distance joint between two sprites. The distance joint keeps the sprites a certain distance apart whilst being allowed to rotate freely around the anchor points. Specify two anchor points in world coordinates with the sprites already at the desired distance apart. The anchor points can be offset from the sprite positions. A joint may be deleted by the system if any of the sprites it connects are deleted.

## Definition

CreateDistanceJoint( iJointIndex, iSpriteIndex1, iSpriteIndex2, x, y, x2, y2, colConnected )

void agk::CreateDistanceJoint( UINT iJointIndex, UINT iSpriteIndex1, UINT iSpriteIndex2, float x, float y, float x2, float y2, int colConnected )

integer CreateDistanceJoint( iSpriteIndex1, iSpriteIndex2, x, y, x2, y2, colConnected )

UINT agk::CreateDistanceJoint( UINT iSpriteIndex1, UINT iSpriteIndex2, float x, float y, float x2, float y2, int colConnected )

## Parameters

- iJointIndex - The ID to use for this joint.
- iSpriteIndex1 - The ID of the first sprite to join.
- iSpriteIndex2 - The ID of the second sprite to join.
- x - The x coordinate of the sprite 1 anchor point.
- y - The y coordinate of the sprite 1 anchor point.
- x2 - The x coordinate of the sprite 2 anchor point.
- y2 - The y coordinate of the sprite 2 anchor point.
- colConnected - Set whether the two sprites connected by the joint can collide with one another, 0=no, 1=yes.