Sets physics body material type (stores materialType in body creation data for future use).
Takes bodyHandle (physics body from b3dCreatePhysicsBody), materialType (integer material ID for categorization, 0=none/default).
Returns nothing.
3D Graphics
Parameters & Returns
Parameters
bodyHandleInt
materialTypeInt
Returns
Void
Quick Summary
Sets physics body material type (stores materialType in body creation data for future use).
Takes bodyHandle (physics body from b3dCreatePhysicsBody), materialType (integer material ID for categorization, 0=none/default).
Returns nothing.
Technical Exegesis...
Sets physics body material type (stores materialType in body creation data for future use). Takes bodyHandle (physics body from b3dCreatePhysicsBody), materialType (integer material ID for categorization, 0=none/default). Returns nothing. Stores material type in g_bodyCreationData, used for material-specific collision response, sound effects, or visual effects. Material metadata storage.
This function sets material type ID. Material type storage: stores materialType in PhysicsBodyData.
Sets physics body material type (stores materialType in body creation data for future use). Takes bodyHandle (physics body from b3dCreatePhysicsBody), materialType (integer material ID for categorization, 0=none/default). Returns nothing. Stores material type in g_bodyCreationData, used for material-specific collision response, sound effects, or visual effects. Material metadata storage.
This function sets material type ID. Material type storage: stores materialType in PhysicsBodyData.materialType (body creation data structure, persists with body until freed), does not affect Jolt physics properties directly (no restitution/friction changes unless explicitly linked), used for game logic categorization (identify material type during collisions). Material type values: materialType is user-defined integer (0 = none/default, 1+ = custom materials like wood, metal, stone, grass, water), no predefined material constants (user assigns meaning to each integer), common convention 0=none, 1=wood, 2=metal, 3=stone, 4=flesh, 5=glass, 6=water, but arbitrary user choice. Use cases: (1) Collision sound effects (check material types of colliding bodies, play appropriate impact sound like metal-on-metal clang vs wood-on-stone thud), (2) Visual effects (emit different particle effects based on material like metal sparks vs wood splinters), (3) Gameplay logic (certain materials take more damage from fire, ice affects water differently than stone), (4) Footstep sounds (raycast to ground, check material type, play matching footstep sound). Common patterns: categorize materials WOOD=1, METAL=2, STONE=3 then b3dSetPhysicsBodyMaterial(cratebody, WOOD), collision sound if mat1=METAL and mat2=STONE then PlaySound(metalOnStone), footstep material groundMat = b3dGetPhysicsBodyMaterial(groundBody) then Select groundMat Case GRASS then PlaySound(grassStep). Typical usage: set after b3dCreatePhysicsBody to categorize object material, read during collision callbacks to determine appropriate response (sounds, effects, damage), use with b3dGetPhysicsBodyMaterial to query material type (likely future function). Material metadata: material type is metadata only (does not change physics behavior automatically), user responsible for material-specific logic (check material type and adjust restitution/friction/sounds manually), allows flexible material system (define any properties per material type in game code). Collision callback integration: during collision callback get material types of both bodies (bodyA material and bodyB material from creation data), determine collision response based on material pair (metal-on-wood vs metal-on-metal different sounds/effects), apply material-specific damage or effects (fire burns wood more than stone). Body creation data: g_bodyCreationData[bodyHandle] stores PhysicsBodyData struct (entityHandle, shapeType, mass, width/height/depth, materialType), persists for body lifetime (allows rescaling physics body with original creation parameters), accessed during rescaling and material queries. Default material: default materialType = 0 when body created (set in b3dCreatePhysicsBody), means no specific material assigned (generic/default collision response), set non-zero material type to override default behavior. Material type persistence: material type persists until explicitly changed (does not reset each frame), remains valid while body exists (deleted when body freed), consistent across rescaling operations (RescalePhysicsBody preserves material type). Performance: O(1) operation (simple integer assignment in std::map), no physics simulation overhead (metadata only), instant (no Jolt API calls). Validation: silently returns if bodyHandle not found in g_bodyCreationData (invalid or freed body, or body created before material system added), no validation on materialType value (any integer allowed, negative values permitted but unusual). Material type retrieval: no current b3dGetPhysicsBodyMaterial function (likely future addition for reading material type), can access g_bodyCreationData directly in C++ for collision callbacks, material type available during collision response for sound/effect selection. Example material system: define constants MATERIAL_WOOD=1, MATERIAL_METAL=2, MATERIAL_STONE=3 then create lookup tables for properties (restitution[MATERIAL_WOOD]=0.3, restitution[MATERIAL_METAL]=0.5), use material type as index for properties during collision response. Related: b3dCreatePhysicsBody creates physics body (initializes materialType to 0), b3dSetPhysicsBodyRestitution sets bounciness (material-specific restitution applied based on material type), b3dSetPhysicsBodyFriction sets friction (material-specific friction applied based on material type), collision callbacks use material type for sound/effect selection.