Returns entity collision type (0-31).
Takes entity (entity handle).
Returns collision type as Int (0-31, or 0 on error).
3D Graphics
Parameters & Returns
Parameters
entityInt
Returns
Int
Quick Summary
Returns entity collision type (0-31).
Takes entity (entity handle).
Returns collision type as Int (0-31, or 0 on error).
Technical Exegesis...
Returns entity collision type (0-31). Takes entity (entity handle). Returns collision type as Int (0-31, or 0 on error). Reads entity.collisionType field.
This function queries collision type. Collision types: 32 possible types (0-31), type 0 = no collision (default/disabled), types 1-31 = user-defined categories, returned value matches what was set by b3dEntityType.
Returns entity collision type (0-31). Takes entity (entity handle). Returns collision type as Int (0-31, or 0 on error). Reads entity.collisionType field.
This function queries collision type. Collision types: 32 possible types (0-31), type 0 = no collision (default/disabled), types 1-31 = user-defined categories, returned value matches what was set by b3dEntityType. Type usage: used for collision filtering in collision matrix, checked during collision detection to determine response, allows grouping entities by category (player, enemies, walls, pickups, etc.). Use cases: (1) Debug collision setup (verify entities have correct types assigned), (2) Dynamic type changes (read current type before modifying), (3) Conditional logic (different behavior based on entity type), (4) Collision analysis (identify what types are colliding), (5) Save/load systems (serialize collision type for level data). Common patterns: debug output = Print "Entity type: " + ToString(b3dGetEntityType(entity)), conditional collision = if b3dGetEntityType(target) = TYPE_ENEMY then damage(), type validation = if b3dGetEntityType(entity) <> TYPE_PLAYER then return, toggle collision = if b3dGetEntityType(entity) = 0 then b3dEntityType(entity, TYPE_WALL) else b3dEntityType(entity, 0). Typical usage: call to verify collision setup is correct, use in gameplay logic to branch based on entity category, query before changing type (to preserve previous value), combine with b3dEntityCollided to identify collision partners. Return value: returns entity.collisionType field (0-31), returns 0 if entity invalid (cannot distinguish from legitimate type 0), no error message on invalid entity (silent fail), default type for new entities is 0 (no collision until set). Error handling: returns 0 for invalid entity handle, returns 0 if entity not found in lookup table, 0 is valid type (no collision) so cannot detect error from return value alone, validate entity exists before calling if error detection needed. Performance: O(1) lookup via FastEntityLookup (hash table or direct index), O(1) field read, negligible cost (simple memory access), safe to call every frame if needed. Type persistence: collision type persists across frames, survives position/rotation changes, preserved during b3dCopyEntity (copied to new entity), cleared when entity freed. Relationship to other functions: counterpart to b3dEntityType (setter/getter pair), used with b3dEntityCollided (filter collisions by type), independent of b3dSetCollisionMode (type vs shape), works with b3dCollisions (type defines matrix lookup). Common type values: 0 = no collision (disabled), 1 = player character, 2 = walls/obstacles, 3 = projectiles/bullets, 4 = enemies/NPCs, 5 = trigger volumes, 6 = pickup items, 7 = moving platforms, 8-31 = user-defined. Collision detection context: collision system checks both entities' types, looks up type pair in collision matrix (via b3dCollisions), determines response based on matrix entry (none/stop/slide), applies response if collision occurs. Debug usage: validate collision setup during development, check entity types in collision callbacks, print entity types in collision debug overlay, verify type assignment after loading scenes. Validation: no parameter validation (accepts any integer), invalid entity handle returns 0 (silent fail), assumes entity handle from valid source, no console output on error. Related: b3dEntityType sets collision type (assigns entity to category), b3dCollisions defines type interaction matrix (response between type pairs), b3dEntityCollided detects collisions with type (filters by collision type), b3dSetCollisionMode sets collision shape (independent of type).
Example
Example.bam
; Query entity collision type
entityType% = b3dGetEntityType(player)
Print "Player collision type: " + ToString(entityType%)
; Conditional logic based on entity typeIf b3dGetEntityType(hitEntity) = TYPE_ENEMY% Then
Print "Hit an enemy!"
ApplyDamage(hitEntity)
ElseIf b3dGetEntityType(hitEntity) = TYPE_PICKUP% Then
Print "Collected pickup!"
CollectItem(hitEntity)
EndIf; Toggle collision on/offIf b3dGetEntityType(platform) = 0Then
b3dEntityType(platform, TYPE_PLATFORM%) ; Enable collision
Else
b3dEntityType(platform, 0) ; Disable collision
EndIf; Debug collision setupFor i% = 1To entityCount%
entityHandle% = entityList[i%]
entityType% = b3dGetEntityType(entityHandle%)
Print "Entity " + ToString(i%) + " has type " + ToString(entityType%)
Next