AW AVATAR YAW
Minimum requirements | ||
---|---|---|
Added in version 2.1 | ||
SDK | build 13 |
AW_AVATAR_YAW
Type
Integer
Description
Yaw of a users avatar.
Notes
This is the value set for AW_MY_YAW 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 0 to 3599.
For positive values of yaw modulo 3600: A yaw of 0 is facing directly north, 900 is facing west, 1800 is facing south, and 2700 is facing east.
For negative values of yaw modulo 3600: A yaw of 0 is facing directly north, -2700 is facing west, -1800 is facing south, and -900 is facing east.
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 yaw of their avatar.
Range
When the user is a browser:
Minimum: | -3599 tenths of a degree |
Maximum: | 3599 tenths of a degree |
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 yaw = aw_int (AW_AVATAR_YAW); /* put angles in the -3599 to 3599 range */ yaw = yaw % 3600; /* turn negative angles into positive, to have a single way of telling the direction */ if (yaw < 0) yaw = yaw + 3600; printf ("%s is facing ", aw_string (AW_AVATAR_NAME)); if (yaw < 450 || yaw >= 3150) printf ("north\n"); else if (yaw >= 450 && yaw < 1350) printf ("west\n"); else if (yaw >= 1350 && yaw < 2250) printf ("south\n"); else if (yaw >= 2250 && yaw < 3150) printf ("east\n"); } aw_event_set (AW_EVENT_AVATAR_CHANGE, handle_avatar_change);