AW AVATAR X

From ActiveWiki
Jump to navigation Jump to search


Minimum requirements
Added in version 2.1
SDKbuild 13


AW_AVATAR_X

Type

Integer

Description

X coordinate of a users avatar.

Notes

This is the value set for AW_MY_X when the user called aw_state_change. It specifies the avatar's position along the east/west axis, with west being positive.

For SDK build 27, world build 44, browser build 430; and later: It is also used by aw_avatar_set to force users into changing their avatar position.

Range

Minimum:-2147483648 centimeters (furthest east)
Maximum:2147483647 centimeters (furthest west)

Usage

#include <math.h>

void handle_avatar_change (void)
{
  int x = aw_int (AW_AVATAR_X);
  int y = aw_int (AW_AVATAR_Y);
  int z = aw_int (AW_AVATAR_Z);
  
  printf ("%s has moved to (%d, %d, %d); coordinates: %.2f%c %.2f%c %.2fa\n",
          aw_string (AW_AVATAR_NAME),
          x,
          y,
          z,
          fabs ((float)z) / 1000,
          z >= 0 ? 'N' : 'S',
          fabs ((float)x) / 1000,
          x >= 0 ? 'W' : 'E',
          (float)y / 1000);
}

aw_event_set (AW_EVENT_AVATAR_CHANGE, handle_avatar_change);

Used by

See also