AW AVATAR PITCH

From ActiveWiki
Jump to navigation Jump to search
Minimum requirements
Added in version 3.4
SDKbuild 29
Worldbuild 50
Browserbuild 445


AW_AVATAR_PITCH

Type

Integer

Description

Pitch of a users avatar.

Notes

This is the value set for AW_MY_PITCH when the user called aw_state_change. It is given in units of one tenth of a degree and should not be assumed to be in the range of -1800 to 1799.

Note that bots can pitch their avatars to be upside down, and they will be shown as such in a browser.

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 the pitch of their avatar.

Range

When the user is a browser:

Minimum:-900 tenths of a degree (looking up)
Maximum:900 tenths of a degree (looking down)

When the user is a bot:

Minimum:-2147483648 tenths of a degree
Maximum:2147483647 tenths of a degree

Usage

void handle_avatar_change (void)
{
  int pitch = aw_int (AW_AVATAR_PITCH);
  
  /* put angles in the -3599 to 3599 range */
  pitch = pitch % 3600;
  
  /* put angles in the -1800 to 1799 range, to have a single way of telling the direction */
  if (pitch < -1800)
    pitch = pitch + 3600;
  if (pitch >= 1800)
    pitch = pitch - 3600;
  
  printf ("%s is looking ", aw_string (AW_AVATAR_NAME));
  if (pitch >= -100 && pitch <= 100)
    printf ("level\n");
  else if (pitch >= -900 && pitch < -100)
    printf ("up\n");
  else if (pitch > 100 && pitch <= 900)
    printf ("down\n");
  else if (pitch < -900 || pitch > 900)
    printf ("upside down\n");
}

aw_event_set (AW_EVENT_AVATAR_CHANGE, handle_avatar_change);

Used by

See also