Sets per-entity collision response (0=SLIDE normal, 1=STOP dead stop, 2=BOUNCE elastic bounce, overrides default).
Takes characterHandle (character controller), entityHandle (specific entity for custom collision response), responseType (0=SLIDE normal collision sliding, 1=STOP halt on contact, 2=BOUNCE reflect velocity).
Returns nothing.
3D Graphics
Parameters & Returns
Parameters
characterHandleInt
entityHandleInt
responseTypeInt
Returns
Void
Quick Summary
Sets per-entity collision response (0=SLIDE normal, 1=STOP dead stop, 2=BOUNCE elastic bounce, overrides default).
Takes characterHandle (character controller), entityHandle (specific entity for custom collision response), responseType (0=SLIDE normal collision sliding, 1=STOP halt on contact, 2=BOUNCE reflect velocity).
Returns nothing.
Technical Exegesis...
Sets per-entity collision response (0=SLIDE normal, 1=STOP dead stop, 2=BOUNCE elastic bounce, overrides default). Takes characterHandle (character controller), entityHandle (specific entity for custom collision response), responseType (0=SLIDE normal collision sliding, 1=STOP halt on contact, 2=BOUNCE reflect velocity). Returns nothing. Stores entity-specific launch response in data.entityLaunchResponses map, overrides default collision behavior when character hits this entity.
Sets per-entity collision response (0=SLIDE normal, 1=STOP dead stop, 2=BOUNCE elastic bounce, overrides default). Takes characterHandle (character controller), entityHandle (specific entity for custom collision response), responseType (0=SLIDE normal collision sliding, 1=STOP halt on contact, 2=BOUNCE reflect velocity). Returns nothing. Stores entity-specific launch response in data.entityLaunchResponses map, overrides default collision behavior when character hits this entity. Use for special collision surfaces (bounce pads, sticky walls, kill zones).
This function sets entity-specific collision response. Response types: 0 SLIDE (normal collision response, character slides along surface, default behavior for all surfaces), 1 STOP (character stops completely on contact, zero velocity, sticky surface), 2 BOUNCE (character bounces off surface, reflects velocity elastically, trampoline effect). Entity-specific override: applies only when character collides with entityHandle (specific entity gets custom response), overrides default launch response (default SLIDE for all surfaces), allows mixed collision types (bounce pad has BOUNCE, wall has SLIDE). Use cases: (1) Bounce pads (trampoline surfaces launch character upward, responseType=2), (2) Sticky walls (wall-running surfaces stop character, responseType=1), (3) Kill zones (hazard surfaces stop momentum, responseType=1 then apply damage), (4) Pinball bumpers (bouncy obstacles reflect character, responseType=2), (5) One-way platforms (stop when landing from above, responseType=1 contextual). Common patterns: bounce pad b3dSetLaunchResponse(char, trampolineEntity, 2), sticky wall b3dSetLaunchResponse(char, wallRunSurface, 1), bumper b3dSetLaunchResponse(char, pinballBumper, 2), hazard b3dSetLaunchResponse(char, lavaFloor, 1). Typical usage: configure during level load (set all special collision responses), apply to gameplay entities (trampoline, bumpers, special platforms), character experiences different collisions per surface type. SLIDE response (0): normal collision sliding (Jolt default character collision behavior), character slides along surface (follows wall contour, smooth movement), maintains horizontal velocity parallel to surface (doesn't stop on wall hit), default for all entities without override. STOP response (1): character velocity set to zero on contact (immediate halt, no bouncing or sliding), useful for sticky surfaces (magnets, adhesive, wall-running), creates sticky feel (character attaches to surface on touch), player input required to resume movement (stuck until deliberate action). BOUNCE response (2): character velocity reflected off surface (elastic collision, bounces away), bounce direction based on surface normal (perpendicular to contact surface), preserves energy (realistic bouncing, may gain height on angled surfaces), useful for trampolines and pinball mechanics. Launch response storage: stores responseType in data.entityLaunchResponses[entityHandle] (map from entity handle to response type), persists until changed or removed, checked during UpdatePhysicsSystem collision resolution (if contact entity in map use override else use default SLIDE). Priority system: when character collides with entity check if entityHandle in entityLaunchResponses map (entity-specific response exists), if exists use entity response (SLIDE/STOP/BOUNCE from map), if not exists use default response (SLIDE for normal collision). Response type clamping: function clamps responseType to 0-2 range (if < 0 set to 0, if > 2 set to 2), ensures valid response type (prevents undefined behavior), user can pass any int but clamped to valid range. Multiple entity responses: can set different responses for multiple entities (each entity custom response), character adapts to each surface (normal walls SLIDE, trampoline BOUNCE), example wall entity response 0, trampoline entity response 2 (character bounces off trampoline only). Bounce mechanics: when response=2 calculates reflection velocity (velocity reflected across contact normal), applies bounce to character momentum (character bounces away from surface), preserves horizontal energy (realistic bounce physics), creates fun gameplay (pinball, trampolines, bumpers). Stop mechanics: when response=1 sets character velocity to zero (all momentum lost on contact), character halts at contact point (stopped dead, no sliding or bouncing), useful for special mechanics (sticky walls for wall-running, magnetic surfaces). Contact detection: UpdatePhysicsSystem detects collisions (CharacterVirtual active contacts), looks up contact entity handle (maps Jolt BodyID to entity handle), checks if entity in entityLaunchResponses map (custom response exists), applies custom response if found (STOP or BOUNCE override SLIDE). Removing response: to remove entity-specific response delete from map (C++ erase, no BambooBasic function currently), revert to default SLIDE for that entity (normal collision behavior), currently no removal function (would need b3dRemoveLaunchResponse). Collision transitions: character moves from normal wall (SLIDE) to bounce pad (BOUNCE), immediate response change (collision behavior switches at contact), responsive gameplay (bounce pads feel different from walls instantly). Launch response vs slope response: launch response affects collision reaction (slide/stop/bounce), slope response affects climbing and sliding (angle limits, friction via b3dSetCharacterSlopeResponse), both can be combined (entity has custom launch AND slope), independent systems (set both for complete surface customization). Bounce pad example: set responseType=2 for trampoline entity (character bounces on contact), position trampoline in level (place under gaps for vertical boost), tune bounce strength via surface properties (angled trampolines for directional launch). Sticky wall example: set responseType=1 for wall-run surface (character stops on contact), implement wall-run logic after stop (check if on wall, enable wall-running state), resume movement when button pressed (player input releases from sticky surface). Performance: O(1) operation (simple map insertion, stores int), lookup cost during physics update (map lookup per collision, fast hash map), negligible overhead (only checked for actual collisions ~1-4 per frame). Default behavior: entities without override use SLIDE (normal collision sliding), allows most surfaces to behave normally (walls, floors standard), override only special surfaces (bounce pads, sticky walls exceptions). Entity handle validity: entityHandle should be valid physics entity (entity with collision geometry), invalid entityHandle still stored (config exists but never used), entity deleted config remains in map (harmless stale data). Validation: silently returns if characterHandle not found (invalid or freed character), clamps responseType to 0-2 range (ensures valid type), no validation on entityHandle (any handle allowed). Related: b3dSetCharacterSlopeResponse sets entity-specific slope behavior (complementary system), b3dCreateCharacterController creates character controller (default SLIDE response for all surfaces), b3dMoveCharacter affected by launch response (collision response changes movement results), b3dIsCharacterOnWall checks wall contact (useful with STOP response for wall-running).