EntityPhysicsUtils

EntityPhysicsUtils Namespace Reference

Utility namespace used by physics. More...

Enumerations

enum EPartIds { PARTID_MAX_SLOTS_log2 = 9, PARTID_MAX_SLOTS = 1 << PARTID_MAX_SLOTS_log2, PARTID_MAX_ATTACHMENTS = 32, PARTID_LINKED = 1 << 30 }

Functions

int ParsePartId (int partId, int &nLevels, int &nSlotBits)
int AllocPartIdRange (int partId, int nSlots)
Allocate next level of slots.
int GetSlotIdx (int partId, int level=0)
Extract slot index from partid; 0 = top level.

Detailed Description

Utility namespace used by physics.

Enumeration Type Documentation

◆ EPartIds

Enumerator
PARTID_MAX_SLOTS

The maximum amount of slots in entity/skeleton/compound statobj.

PARTID_MAX_ATTACHMENTS

The maximum amount of physicalized entity attachments(must be a power of 2 and <32).

PARTID_LINKED

Marks partids that belong to linked entities.

Function Documentation

◆ ParsePartId()

int EntityPhysicsUtils::ParsePartId ( int partId,
int & nLevels,
int & nSlotBits
)
inline

Phys part id format:. Bit 31 = 0 (since partids can't be negative). Bit 30 - 1 if part belongs to an attached entity. Bits 29,28 - count of nested levels (numLevels) - 1, i.e. compound statobj within a cga within an entity. Lowest PARTID_MAX_SLOTS_log2*numLevels bits - indices of slots at the corresponding level. Bits directly above those - attachment id if bit 30 is set.