Sets physics body bounciness (0.0=no bounce, 1.0=perfect bounce, values >1 gain energy).
Takes bodyHandle (physics body from b3dCreatePhysicsBody), restitution (0.0=no bounce like clay, 1.0=perfect elastic bounce like superball, >1=gain energy on bounce).
Returns nothing.
3D Graphics
Parameters & Returns
Parameters
bodyHandleInt
restitutionDouble
Returns
Void
Quick Summary
Sets physics body bounciness (0.0=no bounce, 1.0=perfect bounce, values >1 gain energy).
Takes bodyHandle (physics body from b3dCreatePhysicsBody), restitution (0.0=no bounce like clay, 1.0=perfect elastic bounce like superball, >1=gain energy on bounce).
Returns nothing.
Technical Exegesis...
Sets physics body bounciness (0.0=no bounce, 1.0=perfect bounce, values >1 gain energy). Takes bodyHandle (physics body from b3dCreatePhysicsBody), restitution (0.0=no bounce like clay, 1.0=perfect elastic bounce like superball, >1=gain energy on bounce). Returns nothing. Sets Jolt restitution property, affects collision response when body hits surfaces. Controls energy retention in collisions.
This function configures bounce behavior. Restitution values: 0.
Sets physics body bounciness (0.0=no bounce, 1.0=perfect bounce, values >1 gain energy). Takes bodyHandle (physics body from b3dCreatePhysicsBody), restitution (0.0=no bounce like clay, 1.0=perfect elastic bounce like superball, >1=gain energy on bounce). Returns nothing. Sets Jolt restitution property, affects collision response when body hits surfaces. Controls energy retention in collisions.
This function configures bounce behavior. Restitution values: 0.0 (no bounce, all kinetic energy lost in collision, object stops dead on impact, like clay, wet sand, soft foam), 0.5 (moderate bounce, 50% energy retained, typical for wood, plastic, rubber ball), 1.0 (perfect bounce, 100% energy retained, object bounces to same height, like superball, steel on steel), >1.0 (super bounce, gains energy on collision, unrealistic but fun for game effects, bounces higher each time). Use cases: (1) Realistic materials (0.0 for soft objects, 0.3-0.5 for wood/metal, 0.8-1.0 for rubber), (2) Game feel (high restitution for pinball, low for platformer character), (3) Energy control (low restitution dampens bouncing quickly, high keeps objects bouncing), (4) Special effects (>1.0 for anti-gravity or energy-gaining objects). Common patterns: dead bounce b3dSetPhysicsBodyRestitution(body, 0.0), realistic ball b3dSetPhysicsBodyRestitution(ball, 0.7), superball b3dSetPhysicsBodyRestitution(superball, 0.95), anti-gravity b3dSetPhysicsBodyRestitution(body, 1.2). Typical usage: set after b3dCreatePhysicsBody to configure material properties, combine with b3dSetPhysicsBodyFriction for complete material definition, adjust during gameplay to change bounce behavior (powerups, surface changes). Collision response: when two bodies collide Jolt uses combined restitution (typically max or average of both bodies), higher restitution = more velocity retained perpendicular to collision normal, affects both linear velocity (bounce direction/speed) and angular velocity (spin from impact). Physics integration: restitution applied during collision solve phase (Jolt constraint solver), affects impulse magnitude applied to separate bodies, combined with friction to determine final post-collision velocities. Material combinations: ball(0.8) on floor(0.2) might use max(0.8,0.2)=0.8 for bounce calculation, allows mixing materials naturally (bouncy ball on hard floor vs soft carpet). Performance: O(1) operation (simple property set), restitution processed during collision (minimal overhead per collision pair). Default value: Jolt default restitution typically 0.0 (no bounce unless explicitly set), must call this function to enable bouncing. Validation: silently returns if g_physicsSystem not initialized, silently returns if bodyHandle not found in g_bodyHandleToBodyID, no clamping (values >1.0 allowed for game effects). Related: b3dSetPhysicsBodyFriction sets surface friction (affects sliding resistance), b3dCreatePhysicsBody creates physics body (call this after creation), b3dSetPhysicsBodyVelocity sets velocity (restitution affects velocity changes in collisions).