Applies instant linear impulse to physics body (adds to velocity, respects mass, use for explosions/kicks).
Takes bodyHandle (physics body from b3dCreatePhysicsBody), ix/iy/iz (impulse vector in kg*units/sec, force integrated over instant).
Returns nothing.
3D Graphics
Parameters & Returns
Parameters
bodyHandleInt
ixDouble
iyDouble
izDouble
Returns
Void
Quick Summary
Applies instant linear impulse to physics body (adds to velocity, respects mass, use for explosions/kicks).
Takes bodyHandle (physics body from b3dCreatePhysicsBody), ix/iy/iz (impulse vector in kg*units/sec, force integrated over instant).
Returns nothing.
Technical Exegesis...
Applies instant linear impulse to physics body (adds to velocity, respects mass, use for explosions/kicks). Takes bodyHandle (physics body from b3dCreatePhysicsBody), ix/iy/iz (impulse vector in kg*units/sec, force integrated over instant). Returns nothing. Adds impulse to body linear velocity via Jolt AddImpulse, activates body automatically. Use for explosions, kicks, jumps, or any instant force application.
This function applies linear impulse.
Applies instant linear impulse to physics body (adds to velocity, respects mass, use for explosions/kicks). Takes bodyHandle (physics body from b3dCreatePhysicsBody), ix/iy/iz (impulse vector in kg*units/sec, force integrated over instant). Returns nothing. Adds impulse to body linear velocity via Jolt AddImpulse, activates body automatically. Use for explosions, kicks, jumps, or any instant force application.
This function applies linear impulse. Impulse components: ix (X-axis impulse, positive = push right, negative = push left), iy (Y-axis impulse, positive = push up, negative = push down), iz (Z-axis impulse, positive = push forward, negative = push backward). Impulse physics: impulse = force * time (kg * units/sec, instant force application), velocity change = impulse / mass (lighter objects accelerate more from same impulse), added to current velocity (incremental change, does not replace velocity like b3dSetPhysicsBodyVelocity). Mass interaction: body with mass=10 and impulse iy=100 gains vy = 100/10 = 10 units/sec upward, body with mass=50 and impulse iy=100 gains vy = 100/50 = 2 units/sec upward, heavier bodies gain less velocity from same impulse (realistic physics). Use cases: (1) Explosions (apply outward impulse from explosion center to nearby bodies), (2) Kicks/punches (apply impulse in hit direction when melee attack connects), (3) Jumping (apply upward impulse iy for jump instead of setting velocity), (4) Launching projectiles (apply initial impulse at spawn for realistic ballistics), (5) Wind/force fields (apply continuous small impulses each frame for wind effect). Common patterns: explosion radius For each body in explosion radius then direction = Normalize(bodyPos - explosionPos) then impulse = explosionForce / Distance then b3dApplyPhysicsImpulse(body, direction.x*impulse, direction.y*impulse, direction.z*impulse), jump impulse b3dApplyPhysicsImpulse(player, 0, jumpForce, 0), kick enemy b3dApplyPhysicsImpulse(enemy, kickDir.x*kickForce, kickDir.y*kickForce, kickDir.z*kickForce). Typical usage: apply during collision for impact forces (object hits another, apply impulse based on collision velocity), use for one-time forces (explosions, jumps, hits), combine multiple impulses for complex effects (apply both upward and forward impulse for angled jump). Impulse vs velocity: b3dApplyPhysicsImpulse adds to velocity (preserves momentum, respects mass, realistic physics), b3dSetPhysicsBodyVelocity replaces velocity (ignores mass, direct control, kinematic feel), impulse better for physics-driven forces (explosions, collisions, natural interactions), direct velocity better for character control (scripted movement, precise positioning). Activation: Jolt AddImpulse activates body automatically (wakes sleeping bodies, enables collision detection), ensures impulse takes effect immediately (body responds in next physics step), no manual activation needed. Coordinate system: ix/iy/iz in BambooBasic Y-up world coordinates (same as position/velocity system), passed directly to Jolt Vec3 (no conversion needed), impulse in world space (not local to body rotation). Multiple impulses: can apply multiple impulses in same frame (all accumulated before physics step), final velocity = initial velocity + sum(impulses) / mass, allows combining forces (apply gravity impulse + explosion impulse + wind impulse). Impulse magnitude: small impulse (1-10) for gentle nudges, medium impulse (10-100) for jumps and kicks, large impulse (100-1000) for explosions and high-speed launches, very large impulse (>1000) for extreme forces (cannon shots, supernatural powers). Directional impulse: normalize direction vector before scaling by magnitude (direction = Normalize(target - source), impulse = direction * force), ensures consistent impulse regardless of distance (only direction matters, not magnitude of direction vector), apply same impulse magnitude to all bodies in explosion radius for uniform push. Impulse accumulation: impulse accumulates each frame if applied continuously (velocity increases linearly over time like gravity), discontinuous impulses (explosions, jumps) applied once then velocity decays due to air resistance/friction. Performance: O(1) operation (simple Vec3 add via Jolt BodyInterface), activation triggers broad-phase update (cheap), safe to apply many impulses per frame (Jolt handles efficiently). Static body behavior: static bodies (mass=0, infinite mass) ignore impulses (impulse/mass = impulse/infinity = 0 velocity change), applying impulse to static body has no effect (immovable by definition). Error handling: silently returns if g_physicsSystem not initialized (b3dInitPhysics not called), silently returns if bodyHandle not found in g_bodyHandleToBodyID (invalid or freed body), no validation on impulse magnitude (extreme values allowed but may cause instability). Jolt integration: calls g_physicsSystem->GetBodyInterface().AddImpulse(bodyID, Vec3(ix, iy, iz)), Jolt divides impulse by body mass internally to compute velocity change (deltaV = impulse / mass), adds deltaV to current linear velocity (accumulates with existing momentum). Units: impulse in kg * units/sec (mass * velocity units), must account for body mass when choosing impulse magnitude (heavier bodies need larger impulse for same velocity change). Validation: no parameter validation (negative/zero impulses allowed, may be intentional), no clamping (extreme impulses may cause tunneling or instability, user responsible for reasonable values). Related: b3dSetPhysicsBodyVelocity sets velocity directly (alternative to impulse for direct control), b3dApplyPhysicsTorque applies rotational impulse (spin instead of linear motion), b3dGetPhysicsBodyVelocityX/Y/Z reads current velocity (check result of impulse application), b3dCreatePhysicsBody creates physics body with mass (mass determines impulse effect).