Host should send the following data packet to the IG in order to create, update and delete entities.
All these structures and enumerations are defined in /include/vi_types.h
Send this packet for every new entity to be created.
This packet must be followed by the update entity packet.
Data packet
name
|
type
|
bytes
|
description
|
type
|
uchar
|
2
|
use viENTITY_DESC
|
len
|
uchar
|
2
|
use sizeof(viEntityDesc)
|
frame
|
ushort
|
4
|
num of the packet (sequential)
|
time
|
float
|
4
|
current time in float
|
ent_id
|
ushort
|
2
|
unique entity id
|
oth_id
|
ushort
|
2
|
used when the entity is docked on another one
|
oper
|
uchar
|
1
|
type of operation. See below
|
smooth
|
uchar
|
1
|
true or false. Overwrite the database definition.
|
unsused
|
ushort
|
2
|
unused
|
name
|
char
|
20
|
entity name
|
model
|
char
|
28
|
model name (must exist in the database).
|
Operation values:
oper
|
|
vi_entCreate
|
create the entity
|
vi_entDock
|
dock the entity (ent_id) on another one (oth_id)
|
vi_entUndock
|
undock the entity (ent_id)
|
vi_entDelete
|
remove the entity (ent_id)
|
Send this packet at each entity update. Should be sent immediately after viEntityDesc.
Data packet
name
|
type
|
bytes
|
description
|
type
|
uchar
|
1
|
use viENTITY_STATE
|
len
|
uchar
|
1
|
use sizeof(viEntityState)
|
frame
|
ushort
|
2
|
num of the packet (sequential)
|
time
|
float
|
4
|
current time in float
|
ent_id
|
ushort
|
2
|
unique entity id
|
coords
|
uchar
|
1
|
0=XYZ, 1=LLA, 2=ECEF
|
unused
|
uchar
|
1
|
not used
|
speed
|
float
|
4
|
speed in m/s along the vector
|
pos
|
float[3]
|
12
|
entity position (x, y, z) or (lat, lon, alt)
|
ypr
|
float[3]
|
12
|
entity attitude in radians (yaw, pitch, roll)
|
If acceleration and rotation speeds are provided, the following structure must be used:
Data packet
name
|
type
|
bytes
|
description
|
type
|
uchar
|
1
|
use viENTITY_STATE_EXT
|
len
|
uchar
|
1
|
use sizeof(viEntityStateExt)
|
frame
|
ushort
|
2
|
num of the packet (sequential)
|
time
|
float
|
4
|
current time in float
|
ent_id
|
ushort
|
2
|
unique entity id
|
coords
|
uchar
|
1
|
0=XYZ, 1=LLA, 2=ECEF
|
unused
|
uchar
|
1
|
unused
|
pos
|
float[3]
|
12
|
entity position (x, y, z) or (lat, lon, alt)
|
ypr
|
float[3]
|
12
|
entity attitude in radians (yaw, pitch, roll)
|
vel
|
float[3]
|
12
|
speed vector in m/s (replace speed)
|
rot
|
float[3]
|
12
|
rotation angle on ypr, rad/sec
|
acc
|
float[3]
|
12
|
acceleration on ypr rad/sec2
|
Host can send specific commands to the IG.
The following ones are supported:
Data packet:
name
|
type
|
bytes
|
description
|
type
|
uchar
|
1
|
use viSCENE_CMD
|
len
|
uchar
|
1
|
use sizeof(viSceneCmd)
|
frame
|
ushort
|
2
|
num of the packet (sequential)
|
time
|
float
|
4
|
current time in float
|
oper
|
uchar
|
2
|
operation, see below
|
unused
|
uchar
|
1
|
not used
|
id
|
uchar
|
1
|
entity id or any id
|
data.f
|
float[4]
|
16
|
4 floats
|
data.i
|
int[4]
|
|
4 integers
|
data.s
|
char[16]
|
|
string of 16 characters
|
Operation values:
oper
|
|
Cmd_Unfocus
|
Unfocus the camera (free mode)
|
Cmd_CamTrack
|
Set the camera in track mode on the specified entity (id)
|
Cmd_CamEye
|
Set the camera at the entity (id) eye
|