Aw mover links

From ActiveWiki
Jump to navigation Jump to search


Minimum requirements
Added in version 4.1
SDKbuild 53


int aw_mover_links (int id)

Description

Queries all objects linked to a specified mover in the world.

Callback

None (returns immediately)

Notes

The argument id is the mover's ID, the AW_OBJECT_ID of the mover object. All linked objects are replied by the world server and trigger AW_EVENT_ENTITY_LINKS. See AW_EVENT_ENTITY_ADD for the list of attributes provided with a mover and AW_EVENT_ENTITY_LINKS for the list of attributes provided for linked objects.

Arguments

id
Mover ID.

Argument attributes

None

Return values

RC_SUCCESS
RC_NOT_INITIALIZED
RC_NO_INSTANCE
RC_NO_CONNECTION
The connection to the world is down.
RC_UNAUTHORIZED
Only instances owned by a caretaker (i.e. aw_bool (AW_WORLD_CARETAKER_CAPABILITY) returns 1) may use this method.

Returned attributes

None

Usage

void handle_mover_links (void)
{
  /* receiving links to a mover */
  printf ("Link to mover %d added into scene: %d %s\n",
    aw_int (AW_ENTITY_ID),
    aw_int (AW_OBJECT_TYPE),
    aw_string (AW_OBJECT_MODEL));
}

void handle_entity_add (void)
{
  int rc;
  
  if (aw_int (AW_ENTITY_TYPE) != AW_ENTITY_MOVER)
    return;
  
  printf ("Mover %d %s added into scene\n",
    aw_int (AW_ENTITY_ID),
    aw_string (AW_OBJECT_MODEL));
  
  /* query links to this mover */
  rc = aw_mover_links (aw_int (AW_ENTITY_ID));
  if (rc)
    printf ("Unable to query mover links (reason %d)\n", rc);
}

aw_event_set (AW_EVENT_ENTITY_ADD, handle_entity_add);
aw_event_set (AW_EVENT_ENTITY_LINKS, handle_mover_links);

See also