Aw object bump

From ActiveWiki
Jump to navigation Jump to search


Minimum requirements
Added in version 4.1
SDKbuild 53


int aw_object_bump (void)

Description

Simulates bumping into an object.

Callback

None (returns immediately)

Notes

This method triggers AW_EVENT_OBJECT_BUMP in all the neighbor SDK applications that have subscribed to the event. It is intended for use by the Active Worlds Browser to indicate when a user collides with an object that has a "bump" trigger. However it is also available for use by SDK applications which may wish to simulate bump actions for the purposes of testing, etc.

The object to be bumped can be specified in two ways. This is the old method for doing it:

There is also new method which was introduced in version 4.1:

The attribute AW_OBJECT_SYNC can be set to 1 (true) if the object bump should be propagated to all neighbors within range. This has the same effect as a user clicking on building commands that have a 'global' parameter. If this is not desired then set AW_OBJECT_SYNC to 0 (false). The attribute is automatically reset to 0 (false) before aw_object_bump returns.

For world build 95 or later, and SDK build 75 and later: The attribute AW_OBJECT_SESSION_TO can be set to the recipient. Only this session number will recieve AW_EVENT_OBJECT_BUMP.

Arguments

None

Argument attributes

AW_OBJECT_NUMBER
AW_OBJECT_X
AW_OBJECT_Z
AW_OBJECT_ID
AW_OBJECT_SYNC
AW_OBJECT_SESSION_TO

Return values

RC_SUCCESS
RC_NOT_INITIALIZED
RC_NO_INSTANCE
RC_NO_CONNECTION
The connection to the world is down.

Returned attributes

AW_OBJECT_SYNC
Is set to 0.
AW_OBJECT_SESSION_TO
Is set to 0.

Usage

Simulate an avatar-bump on an object.

void bump_object (int id)
{
  int rc;
  
  aw_int_set (AW_OBJECT_ID, id);
  aw_int_set (AW_OBJECT_SYNC, 1); /* makes it 'global' */
  aw_int_set (AW_OBJECT_NUMBER, 0);
  aw_int_set (AW_OBJECT_X, 0);
  aw_int_set (AW_OBJECT_Z, 0);
  aw_int_set (AW_OBJECT_SESSION_TO, 4711); /* for session 4711 only */
  
  rc = aw_object_bump ();
  if (rc != RC_SUCCESS)
    printf ("Object bump failed (reason %d)\n", rc);
}

See also