b3dGetEntityType

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

entity Int

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.

Example

Example.bam
; Query entity collision type
entityType% = b3dGetEntityType(player)
Print "Player collision type: " + ToString(entityType%)

; Conditional logic based on entity type
If 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/off
If b3dGetEntityType(platform) = 0 Then
    b3dEntityType(platform, TYPE_PLATFORM%)  ; Enable collision
Else
    b3dEntityType(platform, 0)  ; Disable collision
EndIf

; Debug collision setup
For i% = 1 To entityCount%
    entityHandle% = entityList[i%]
    entityType% = b3dGetEntityType(entityHandle%)
    Print "Entity " + ToString(i%) + " has type " + ToString(entityType%)
Next