b3dEntityType

Sets entity collision type (0-31) for collision filtering. Takes entity (entity handle), typeID (collision type 0-31, where 0 = no collision). Returns nothing.

3D Graphics

Parameters & Returns

Parameters

entity Int
typeID Int

Returns

Void

Quick Summary

Sets entity collision type (0-31) for collision filtering. Takes entity (entity handle), typeID (collision type 0-31, where 0 = no collision). Returns nothing.

Technical Exegesis...

Sets entity collision type (0-31) for collision filtering. Takes entity (entity handle), typeID (collision type 0-31, where 0 = no collision). Returns nothing. Stores typeID in entity.collisionType field and initializes prevPosition for movement tracking.

This function assigns collision type. Collision types: 32 possible types (0-31), type 0 = no collision (special default value), types 1-31 = user-defined categories (player, enemies, walls, pickups, etc.

Example

Example.bam
; Setup collision types for game entities
Const TYPE_PLAYER% = 1
Const TYPE_WALL% = 2
Const TYPE_ENEMY% = 3
Const TYPE_PICKUP% = 4
Const TYPE_TRIGGER% = 5

; Create entities and assign types
player = b3dCreateCube()
b3dEntityType(player, TYPE_PLAYER%)

wall = b3dCreateCube()
b3dEntityType(wall, TYPE_WALL%)

enemy = b3dCreateSphere()
b3dEntityType(enemy, TYPE_ENEMY%)

healthPickup = b3dCreateSphere()
b3dEntityType(healthPickup, TYPE_PICKUP%)

; Configure collision responses
b3dCollisions(TYPE_PLAYER%, TYPE_WALL%, 2)    ; Player slides on walls
b3dCollisions(TYPE_PLAYER%, TYPE_ENEMY%, 1)   ; Player stops at enemies
b3dCollisions(TYPE_PLAYER%, TYPE_PICKUP%, 0)  ; Player passes through pickups
b3dCollisions(TYPE_PLAYER%, TYPE_TRIGGER%, 0) ; Player passes through triggers

; Disable collision for a ghost entity
ghost = b3dCreateCube()
b3dEntityType(ghost, 0)  ; Type 0 = no collision