IS OBH
Introduction
The OBject Hit packet is sent by LFS when a car collides with an object (not only layout objects). This packet is only sent if ISF_OBH is set in IS_ISI.
| Type | Name | Description |
|---|---|---|
| byte | Size | 28 |
| byte | Type | ISP_OBH |
| byte | ReqI | 0 |
| byte | PLID | player's unique id |
| word | SpClose | high 4 bits: reserved / low 12 bits: closing speed (10 = 1 m/s) |
| word | SpW | |
| unsigned | Time | time stamp (ms) |
| CarContOBJ | C | |
| short | X | as in ObjectInfo |
| short | Y | as in ObjectInfo |
| byte | Zbyte | if OBH_LAYOUT is set: Zbyte as in ObjectInfo |
| byte | Sp1 | |
| byte | Index | AXO_x as in ObjectInfo or zero if it is an unknown object |
| byte | OBHFlags | see below |
Packet Details
Size
The size of the packet is always 28 bytes.
Type
The packet type from the ISP_ enumeration, always ISP_OBH.
ReqI
ReqI is always equal to zero.
SpClose
Only the 12 lower bits are used to encode the closing speed, where a value of 10 corresponds to 1 m/s.
Time
The timestamp of the contact.
C
A CarContOBJ giving details about the involved car.
X
The X coordinate of the object, as in ObjectInfo.
Y
The Y coordinate of the object, as in ObjectInfo.
Zbyte
The Z coordinate of the object, as in ObjectInfo.
Index
The AXO_ index of the object, as in ObjectInfo, or 0 if the object is unknown.
OBHFlags
Flags for the hit event:
#define OBH_LAYOUT 1 // an added object #define OBH_CAN_MOVE 2 // a movable object #define OBH_WAS_MOVING 4 // was moving before this hit #define OBH_ON_SPOT 8 // object in original position
Notes
The OBHFlags can help determine if a car hit an object that has already been hit by another car: if OBH_CAN_MOVE and OBH_WAS_MOVING are both set, the car hit a moving object (caused by a previous hit).