User Position Capability
C Reference » Production Nodes Functionality » Depth Generator

## Functions

XN_C_API XnUInt32 XN_C_DECL | xnGetSupportedUserPositionsCount (XnNodeHandle hInstance)
XN_C_API XnStatus XN_C_DECL | xnSetUserPosition (XnNodeHandle hInstance, XnUInt32 nIndex, const XnBoundingBox3D *pPosition)
XN_C_API XnStatus XN_C_DECL | xnGetUserPosition (XnNodeHandle hInstance, XnUInt32 nIndex, XnBoundingBox3D *pPosition)
XN_C_API XnStatus XN_C_DECL | xnRegisterToUserPositionChange (XnNodeHandle hInstance, XnStateChangedHandler handler, void *pCookie, XnCallbackHandle *phCallback)
XN_C_API void XN_C_DECL | xnUnregisterFromUserPositionChange (XnNodeHandle hInstance, XnCallbackHandle hCallback)

## Detailed Description

The User Position capability (XN_CAPABILITY_USER_POSITION) allows a Depth Generator to change its output, so that it would be optimized in specific locations in the scene.

## Function Documentation

## xnGetSupportedUserPositionsCount()

XN_C_API XnUInt32 XN_C_DECL xnGetSupportedUserPositionsCount | ( | XnNodeHandle | hInstance | ) |

Gets the number of user positions supported by this generator.

Parameters

  hInstance | [in] A handle to the instance.

Returns
  0 if this production node does not support the User Position capability.

## xnGetUserPosition()

XN_C_API XnStatus XN_C_DECL xnGetUserPosition | ( | XnNodeHandle | hInstance,
|  | XnUInt32 | nIndex,
|  | XnBoundingBox3D * | pPosition )

Gets the current user position.

Parameters

  hInstance | [in] A handle to the instance.
  nIndex | [in] The user position to get.
  pPosition | [out] The user position.

Returns
  XN_STATUS_INVALID_OPERATION if this production node does not support the User Position capability.

## xnRegisterToUserPositionChange()

XN_C_API XnStatus XN_C_DECL xnRegisterToUserPositionChange | ( | XnNodeHandle | hInstance,
|  | XnStateChangedHandler | handler,
|  | void * | pCookie,
|  | XnCallbackHandle * | phCallback )

Registers a callback function to user position changes.

Parameters

  hInstance | [in] A handle to the instance.
  handler | [in] A pointer to a function that will be called when user position changes.
  pCookie | [in] A user cookie that will be passed to the callback function.
  phCallback | [out] Optional. Will be filled with a handle to be passed to xnUnregisterFromUserPositionChange.

Returns
  XN_STATUS_INVALID_OPERATION if this production node does not support the User Position capability.

## xnSetUserPosition()

XN_C_API XnStatus XN_C_DECL xnSetUserPosition | ( | XnNodeHandle | hInstance,
|  | XnUInt32 | nIndex,
|  | const XnBoundingBox3D * | pPosition )

Sets the current user position.

Parameters

  hInstance | [in] A handle to the instance.
  nIndex | [in] The user position to set.
  pPosition | [in] The user position in the frame.

Returns
  XN_STATUS_INVALID_OPERATION if this production node does not support the User Position capability.

## xnUnregisterFromUserPositionChange()

XN_C_API void XN_C_DECL xnUnregisterFromUserPositionChange | ( | XnNodeHandle | hInstance,
|  | XnCallbackHandle | hCallback )

Unregisters a callback function which was registered using xnRegisterToUserPositionChange.

Parameters

  hInstance | [in] A handle to the instance.
  hCallback | [in] The handle to the callback returned from xnRegisterToUserPositionChange.