Aw mover set position

From ActiveWiki
Jump to navigation Jump to search


Minimum requirements
Added in version 4.1
SDKbuild 53


int aw_mover_set_position (int id, int x, int y, int z, int yaw, int pitch, int roll)

Description

Sets the position (in world) of a mover.

Callback

None (returns immediately)

Notes

The provided coordinates and rotations are reflected in AW_ENTITY_X, AW_ENTITY_Y, AW_ENTITY_Z, AW_ENTITY_YAW, AW_ENTITY_PITCH and AW_ENTITY_ROLL within the AW_EVENT_ENTITY_CHANGE event. Note, that the sending application will not receive this event, although it will receive all of these events when issued by others.

Arguments

id
Mover ID (see AW_ENTITY_ID).
x
X coordinate (west/east) in centimeters.
y
Y coordinate (altitude) in centimeters.
z
Z coordinate (north/south) in centimeters.
yaw
Rotation around the Y axis, in tenths of a degree.
pitch
Rotation around the X axis, in tenths of a degree.
roll
Rotation around the Z axis, in tenths of a degree.

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_entity_change (void)
{
  if (aw_int (AW_ENTITY_TYPE) != AW_ENTITY_MOVER)
    return;
  
  printf ("Mover %d changed state: %d @ (%d, %d, %d)\n",
    aw_int (AW_ENTITY_ID),
    aw_int (AW_ENTITY_STATE),
    aw_int (AW_ENTITY_X),
    aw_int (AW_ENTITY_Y),
    aw_int (AW_ENTITY_Z));
}

aw_event_set (AW_EVENT_ENTITY_CHANGE, handle_entity_change);

while (!aw_wait (1000))
{
  /* ... */
  x    += 500;
  z    -= 500;
  roll += 150;
  aw_mover_set_position (id, x, y, z, yaw, pitch, roll)
  /* ... */
}

See also