‹›
Current project

Ragdolls in GameMaker

Creation validates bone names, hierarchy and rest pose before building articulated rigid bodies and internal SwingTwist/SixDOF joints. Failure returns undefined and cleans partial resources. Physics uses the existing jolt_update; registered rendering refreshes skinning automatically. Do not render the original animated instance on top. Models/materials remain game-owned.

Example#

GML
model = new BBMOD_Model("character.bbmod");
asset = jolt_asset_load("character.jolt.json");
// After jolt_start():
ragdoll = jolt_asset_create_ragdoll(asset, model);
if (!is_undefined(ragdoll)) {
    ragdoll.set_position(0, 0, 2);
    ragdoll.set_renderer(o_control_bbmod_renderer.renderer);
    ragdoll.set_grab_enabled(true);
}

Usage and limits#

For animation handoff update the animation player first, set the ragdoll asset transform and call set_pose_from_animation(player) before the next physics step. set_velocity(x,y,z) transfers desired velocity; limb velocities are not inferred. This is passive physics without powered pose control, automatic standing-up or a return-to-animation transition.

get_body(key_or_uuid) exposes a part. get_bone_transform(name) returns the world bone origin, not the shape center. set_grab_enabled(true) opts every part into Carry, off by default. The selected body is held and others follow their joints. Disabling or destroying releases. Internal joints are allowed; ordinary external joints remain restrictions. Carry mass/force limits apply to the selected part. destroy removes owned joints and bodies before the world shuts down.

API reference#

Public function and method signatures. Call methods on the returned instance; parameters with defaults are optional.

Verified operation contracts#

These contracts distinguish units, return values, errors and lifetime according to the current implementation. Check results: false, 0 and undefined can mean different things for different methods.

Symbol / ownerSignatureOperation contract
jolt_asset_create_ragdolljolt_asset_create_ragdoll(asset,model)Validated ragdoll asset + loaded skinned BBMOD model with matching nodes/bind pose. JoltRagdoll/undefined, cleans created parts on failure. Owns physical parts/joints, borrows model.
JoltRagdoll.destroyJoltRagdoll.destroy()Boolean; is_valid checks every part. Destroy detaches renderer and destroys joints/parts, not the model; returns combined success.
JoltRagdoll.get_bodyJoltRagdoll.get_body(ref)Exact part string ref → JoltBody/undefined; bone name → current world transform/undefined after update. Caller does not own internal bodies; destroying one invalidates ragdoll.
JoltRagdoll.get_bone_transformJoltRagdoll.get_bone_transform(name)Exact part string ref → JoltBody/undefined; bone name → current world transform/undefined after update. Caller does not own internal bodies; destroying one invalidates ragdoll.
JoltRagdoll.get_grab_enabledJoltRagdoll.get_grab_enabled()Boolean/0/1 for all physical parts, default false. Setter Boolean, disabling releases held parts; getter true only when all parts enabled and ragdoll valid.
JoltRagdoll.is_validJoltRagdoll.is_valid()Boolean; is_valid checks every part. Destroy detaches renderer and destroys joints/parts, not the model; returns combined success.
JoltRagdoll.renderJoltRagdoll.render()Update Boolean builds bone transforms from physics without stepping solver. Render calls update then Model.render with skin and identity matrix, no success return.
JoltRagdoll.set_grab_enabledJoltRagdoll.set_grab_enabled(enabled)Boolean/0/1 for all physical parts, default false. Setter Boolean, disabling releases held parts; getter true only when all parts enabled and ragdoll valid.
JoltRagdoll.set_pose_from_animationJoltRagdoll.set_pose_from_animation(player)Matching updated BBMOD AnimationPlayer; Boolean. After setting ragdoll position/rotation, before physics step transfers pose and zeros linear/angular velocities. Not continuous blending/IK.
JoltRagdoll.set_positionJoltRagdoll.set_position(x,y,z)Boolean; world origin XYZ m / Euler XYZ° moves the whole assembly preserving relative frames, velocity XYZ m/s sets every part. Updates proceed part by part, not transactionally.
JoltRagdoll.set_rendererJoltRagdoll.set_renderer(renderer)Renderer with add/remove or undefined; Boolean, performs removal/addition itself, do not add ragdoll twice.
JoltRagdoll.set_rotation_eulerJoltRagdoll.set_rotation_euler(x,y,z)Boolean; world origin XYZ m / Euler XYZ° moves the whole assembly preserving relative frames, velocity XYZ m/s sets every part. Updates proceed part by part, not transactionally.
JoltRagdoll.set_velocityJoltRagdoll.set_velocity(x,y,z)Boolean; world origin XYZ m / Euler XYZ° moves the whole assembly preserving relative frames, velocity XYZ m/s sets every part. Updates proceed part by part, not transactionally.
JoltRagdoll.updateJoltRagdoll.update()Update Boolean builds bone transforms from physics without stepping solver. Render calls update then Model.render with skin and identity matrix, no success return.