Carry: moving objects
Carry is the current jolt_grabber() controller. Enable eligible bodies with set_grab_enabled(true). It holds the center of mass unless set_grab_point(x,y,z) defines a body-local point; change that point after release.
Example#
body.set_grab_enabled(true);
carry = jolt_grabber();
carry.set_camera(o_control_bbmod_camera);
carry.set_distances(3, 1.5, 0.1, 3, 4);
carry.set_preserve_grab_distance(true);
carry.set_max_mass(30);
carry.set_strength(1200);
carry.set_max_torque(300);
// End Step:
carry.update_controls();Usage and limits#
set_distances takes selection reach, hold distance, minimum, maximum and break distance in metres. Require min ≤ hold ≤ max and break > max(reach, maximum). preserve_grab_distance defaults false in the library; the demo enables it.
Default input is LMB pick/release, RMB plus mouse rotate, wheel distance, R realign and F throw. Camera Step must honor carry.controls_use_mouse(id) before mouse-look; call update_controls in End Step after the camera. Lost focus or missing/unlocked camera releases. Do not process automatic and manual input twice.
set_auto_upright, set_yaw_follow and set_snap_step act through physical torque; orientation options default off. Collision, mass and force limits remain effective. External joints normally block Carry. Internal ragdoll joints and opted-in hosts with attached controls are supported; moving handles are not Carry items. Soft Bodies use get_held_type()/get_soft_body(), while get_body() remains rigid-only. get_last_reason() explains failed acquisition. Destroy the grabber in Clean Up.
API reference#
Public function and method signatures. Call methods on the returned instance; parameters with defaults are optional.
Related guides#
Penetration relationships are exempt from the usual rejection of externally constrained mechanisms. Rigid bodies, ragdolls and Soft Bodies are supported; held_type distinguishes them. Force and torque remain limited and contact can change the held orientation.
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 / owner | Signature | Operation contract |
|---|---|---|
| jolt_grabber | jolt_grabber(options=undefined) | Requires jolt_start, returns JoltGrabber or undefined. Only carry profile; default distances 3/1.5/0.1/3/4 m, max_mass 30 kg, break_delay 0.1 s, preserve_distance/upright/yaw/socket_pull false. Layers is a creation option. Rejects legacy damping: use damping_ratio. |
| JoltBody.clear_grab_point | JoltBody.clear_grab_point() | Body-origin local point in m, setter/clear Boolean. Clear restores automatic point; getter {x, y, z} or undefined. Not the current world hand point. |
| JoltBody.get_grab_enabled | JoltBody.get_grab_enabled() | Independent opt-in flags, default false. Setter Boolean/0/1 → Boolean; getter Boolean, also false on error. Grip now accepts Static and Kinematic, not Dynamic; grab_enabled does not bypass other Carry conditions. |
| JoltBody.get_local_grab_point | JoltBody.get_local_grab_point() | Body-origin local point in m, setter/clear Boolean. Clear restores automatic point; getter {x, y, z} or undefined. Not the current world hand point. |
| JoltBody.set_grab_enabled | JoltBody.set_grab_enabled(enabled) | Independent opt-in flags, default false. Setter Boolean/0/1 → Boolean; getter Boolean, also false on error. Grip now accepts Static and Kinematic, not Dynamic; grab_enabled does not bypass other Carry conditions. |
| JoltBody.set_grab_point | JoltBody.set_grab_point(x,y,z) | Body-origin local point in m, setter/clear Boolean. Clear restores automatic point; getter {x, y, z} or undefined. Not the current world hand point. |
| JoltGrabber.add_distance | JoltGrabber.add_distance(delta) | Boolean; distance or increment in m. Native limits holding according to controller bounds; add_distance starts from get_distance. |
| JoltGrabber.controls_use_mouse | JoltGrabber.controls_use_mouse(view) | Boolean whether the given live mouse-locked camera should yield mouse input to held-item manual rotation. Call in Camera Step before consuming deltas. |
| JoltGrabber.destroy | JoltGrabber.destroy() | Boolean, repeated call after destruction true. Release drops the item; destroy also removes the controller. Neither owns/destroys the held object. |
| JoltGrabber.get_applied_force | JoltGrabber.get_applied_force() | Number: position error m / applied force N / hold distance m. Invalid controller returns 0; zero alone does not prove validity. |
| JoltGrabber.get_body | JoltGrabber.get_body() | Returns managed rigid JoltBody / Soft Body according to method; undefined when empty or holding the other type. |
| JoltGrabber.get_distance | JoltGrabber.get_distance() | Number: position error m / applied force N / hold distance m. Invalid controller returns 0; zero alone does not prove validity. |
| JoltGrabber.get_error_distance | JoltGrabber.get_error_distance() | Number: position error m / applied force N / hold distance m. Invalid controller returns 0; zero alone does not prove validity. |
| JoltGrabber.get_grab_point | JoltGrabber.get_grab_point() | World {x, y, z} in m for reference / grab / target; undefined when not holding or on error. |
| JoltGrabber.get_grab_rotation | JoltGrabber.get_grab_rotation() | World XYZW quaternion of target / reference / actual body or held soft-body patch. undefined on error or when not holding. |
| JoltGrabber.get_grab_vertex_count | JoltGrabber.get_grab_vertex_count() | Type is none/body/soft_body. Selected soft-vertex count is numeric, 0 without a hold; not the cloth total vertex count. |
| JoltGrabber.get_held_type | JoltGrabber.get_held_type() | Type is none/body/soft_body. Selected soft-vertex count is numeric, 0 without a hold; not the cloth total vertex count. |
| JoltGrabber.get_ignore_holder_collision | JoltGrabber.get_ignore_holder_collision() | Boolean current flag, also false on error. |
| JoltGrabber.get_last_reason | JoltGrabber.get_last_reason() | Diagnostic string none/released/no_source/no_hit/grab_disabled/invalid_motion/mass_limit/mechanism/already_held/support_body/out_of_reach/break_distance/body_changed/body_destroyed/holder_destroyed/numerical_failure/physics_locked; invalid_handle when invalid. |
| JoltGrabber.get_profile | JoltGrabber.get_profile() | Only the string carry. Setter Boolean, getter carry or undefined for invalid object. The old controller is not another supported profile. |
| JoltGrabber.get_reference_point | JoltGrabber.get_reference_point() | World {x, y, z} in m for reference / grab / target; undefined when not holding or on error. |
| JoltGrabber.get_reference_rotation | JoltGrabber.get_reference_rotation() | World XYZW quaternion of target / reference / actual body or held soft-body patch. undefined on error or when not holding. |
| JoltGrabber.get_soft_body | JoltGrabber.get_soft_body() | Returns managed rigid JoltBody / Soft Body according to method; undefined when empty or holding the other type. |
| JoltGrabber.get_status | JoltGrabber.get_status() | On-demand struct: profile, holding, manual_rotation, reason, source_distance, position_error (m), rotation_error (°), force (N), torque_budget (N·m), saturation, force_usage, torque_usage, socket_pulling; undefined when invalid. Do not poll merely for player movement. |
| JoltGrabber.get_target_point | JoltGrabber.get_target_point() | World {x, y, z} in m for reference / grab / target; undefined when not holding or on error. |
| JoltGrabber.get_target_rotation | JoltGrabber.get_target_rotation() | World XYZW quaternion of target / reference / actual body or held soft-body patch. undefined on error or when not holding. |
| JoltGrabber.get_unlock_physics_locked | JoltGrabber.get_unlock_physics_locked() | Boolean current flag, also false on error. |
| JoltGrabber.get_up | JoltGrabber.get_up() | World nonzero finite Up vector; setter Boolean, getter {x, y, z} or undefined. |
| JoltGrabber.grab | JoltGrabber.grab() | Boolean acquisition attempt from the latest source. Requires grab_enabled and a supported object; inspect get_last_reason on failure. Supports rigid and soft bodies; Socket pulling is opt-in. |
| JoltGrabber.is_holding | JoltGrabber.is_holding() | Boolean, also false for an invalid controller. |
| JoltGrabber.is_manual_rotation | JoltGrabber.is_manual_rotation() | Setter Boolean/0/1 input and Boolean success, getter Boolean (also false on error). Manual mode changes the physical rotation target. |
| JoltGrabber.is_valid | JoltGrabber.is_valid() | Boolean validation of wrapper and native handle. |
| JoltGrabber.realign | JoltGrabber.realign() | Boolean; requests target realignment, not an immediate transform. |
| JoltGrabber.release | JoltGrabber.release() | Boolean, repeated call after destruction true. Release drops the item; destroy also removes the controller. Neither owns/destroys the held object. |
| JoltGrabber.rotate | JoltGrabber.rotate(yaw,pitch,roll=0) | Boolean; finite yaw/pitch/roll increments in degrees around Camera Up/Right/Forward. Roll defaults 0. Does not teleport the body. |
| JoltGrabber.rotate_mouse | JoltGrabber.rotate_mouse(dx,dy,dt=undefined) | Boolean; yaw/pitch/roll °/s or mouse dx/dy pixels. dt in (0, 0.25] s; omitted uses delta_time, fallback 1/60, cap 0.25. Refresh every input frame; rotate_mouse uses sensitivity and reverses X yaw. |
| JoltGrabber.scroll_distance | JoltGrabber.scroll_distance(steps) | Boolean; finite step count multiplied by distance_step; distance respects min/max. |
| JoltGrabber.set_auto_upright | JoltGrabber.set_auto_upright(value) | Boolean result; Boolean or exact 0/1 input, default false. Preserve acquired distance / automatic upright / yaw following / pulling breakable Sockets according to name. |
| JoltGrabber.set_break_delay | JoltGrabber.set_break_delay(value) | Boolean; finite value, range 0..2, public unit s. Changes the controller, not held-body mass or transform. Throw max speed caps added velocity, not total velocity. |
| JoltGrabber.set_break_distance | JoltGrabber.set_break_distance(value) | Boolean; individual distance in m must satisfy the entire current set_distances range. Use atomic set_distances for multiple bounds to avoid an invalid intermediate state. |
| JoltGrabber.set_camera | JoltGrabber.set_camera(source) | Camera object asset, live instance or undefined; Boolean. Changing camera releases the item. Camera must expose camera.Position/Target/Up with X/Y/Z and mouse_locked. |
| JoltGrabber.set_damping_ratio | JoltGrabber.set_damping_ratio(value) | Boolean; finite value, range 0.05..10, public unit ratio. Changes the controller, not held-body mass or transform. Throw max speed caps added velocity, not total velocity. |
| JoltGrabber.set_debug_break_range | JoltGrabber.set_debug_break_range(enabled) | Strict Boolean input, Boolean result. Defaults false/false/true. Changes diagnostic drawing only. |
| JoltGrabber.set_debug_details | JoltGrabber.set_debug_details(enabled) | Strict Boolean input, Boolean result. Defaults false/false/true. Changes diagnostic drawing only. |
| JoltGrabber.set_debug_labels | JoltGrabber.set_debug_labels(enabled) | Strict Boolean input, Boolean result. Defaults false/false/true. Changes diagnostic drawing only. |
| JoltGrabber.set_distance | JoltGrabber.set_distance(distance) | Boolean; distance or increment in m. Native limits holding according to controller bounds; add_distance starts from get_distance. |
| JoltGrabber.set_distance_step | JoltGrabber.set_distance_step(value) | Boolean; finite value, range 0.001..100, public unit m. Changes the controller, not held-body mass or transform. Throw max speed caps added velocity, not total velocity. |
| JoltGrabber.set_distances | JoltGrabber.set_distances(grab,hold,minimum,maximum,break) | Boolean, atomic distances in m: grab, hold, min, max, break. 0.01<=min<=hold<=max<=10000, grab 0.01..10000, break<=20000 and >max(grab, max). Failure preserves previous settings. |
| JoltGrabber.set_follow_speed | JoltGrabber.set_follow_speed(value) | Boolean; finite value, range 0.001..1000, public unit m/s. Changes the controller, not held-body mass or transform. Throw max speed caps added velocity, not total velocity. |
| JoltGrabber.set_frequency | JoltGrabber.set_frequency(value) | Boolean; finite value, range 0.1..60, public unit Hz. Changes the controller, not held-body mass or transform. Throw max speed caps added velocity, not total velocity. |
| JoltGrabber.set_grab_button | JoltGrabber.set_grab_button(button) | Boolean; integer mouse buttons 0..5 / keys 0..255. 0 disables action; defaults left, right, R, F. |
| JoltGrabber.set_grab_distance | JoltGrabber.set_grab_distance(value) | Boolean; individual distance in m must satisfy the entire current set_distances range. Use atomic set_distances for multiple bounds to avoid an invalid intermediate state. |
| JoltGrabber.set_hold_distance | JoltGrabber.set_hold_distance(value) | Boolean; individual distance in m must satisfy the entire current set_distances range. Use atomic set_distances for multiple bounds to avoid an invalid intermediate state. |
| JoltGrabber.set_holder | JoltGrabber.set_holder(holder) | Live same-world JoltCharacter or undefined. Boolean; preserves current ignore_holder_collision, does not own the Character. |
| JoltGrabber.set_ignore_holder_collision | JoltGrabber.set_ignore_holder_collision(ignore) | Boolean result; Boolean or exact 0/1. Ignore collision with holder / allow unlocking physics_locked on grab; default false. |
| JoltGrabber.set_manual_rotation | JoltGrabber.set_manual_rotation(enabled) | Setter Boolean/0/1 input and Boolean success, getter Boolean (also false on error). Manual mode changes the physical rotation target. |
| JoltGrabber.set_manual_sensitivity | JoltGrabber.set_manual_sensitivity(value) | Boolean; finite value, range 0.001..20, public unit °/pixel. Changes the controller, not held-body mass or transform. Throw max speed caps added velocity, not total velocity. |
| JoltGrabber.set_manual_velocity | JoltGrabber.set_manual_velocity(yaw,pitch,roll=0,dt=undefined) | Boolean; yaw/pitch/roll °/s or mouse dx/dy pixels. dt in (0, 0.25] s; omitted uses delta_time, fallback 1/60, cap 0.25. Refresh every input frame; rotate_mouse uses sensitivity and reverses X yaw. |
| JoltGrabber.set_max_acceleration | JoltGrabber.set_max_acceleration(value) | Boolean; finite value, range 0.001..1000, public unit m/s². Changes the controller, not held-body mass or transform. Throw max speed caps added velocity, not total velocity. |
| JoltGrabber.set_max_angular_acceleration | JoltGrabber.set_max_angular_acceleration(value) | Boolean; finite value, range 0.001..1000 rad/s² converted from input degrees, public unit °/s². Changes the controller, not held-body mass or transform. Throw max speed caps added velocity, not total velocity. |
| JoltGrabber.set_max_mass | JoltGrabber.set_max_mass(value) | Boolean; finite value, range 0.001..1000000, public unit kg. Changes the controller, not held-body mass or transform. Throw max speed caps added velocity, not total velocity. |
| JoltGrabber.set_max_torque | JoltGrabber.set_max_torque(value) | Boolean; finite value, range 0.001..100000000, public unit N·m. Changes the controller, not held-body mass or transform. Throw max speed caps added velocity, not total velocity. |
| JoltGrabber.set_maximum_distance | JoltGrabber.set_maximum_distance(value) | Boolean; individual distance in m must satisfy the entire current set_distances range. Use atomic set_distances for multiple bounds to avoid an invalid intermediate state. |
| JoltGrabber.set_minimum_distance | JoltGrabber.set_minimum_distance(value) | Boolean; individual distance in m must satisfy the entire current set_distances range. Use atomic set_distances for multiple bounds to avoid an invalid intermediate state. |
| JoltGrabber.set_preserve_grab_distance | JoltGrabber.set_preserve_grab_distance(value) | Boolean result; Boolean or exact 0/1 input, default false. Preserve acquired distance / automatic upright / yaw following / pulling breakable Sockets according to name. |
| JoltGrabber.set_profile | JoltGrabber.set_profile(profile) | Only the string carry. Setter Boolean, getter carry or undefined for invalid object. The old controller is not another supported profile. |
| JoltGrabber.set_realign_key | JoltGrabber.set_realign_key(key) | Boolean; integer mouse buttons 0..5 / keys 0..255. 0 disables action; defaults left, right, R, F. |
| JoltGrabber.set_reference_acceleration | JoltGrabber.set_reference_acceleration(value) | Boolean; finite value, range 0.001..1000, public unit m/s². Changes the controller, not held-body mass or transform. Throw max speed caps added velocity, not total velocity. |
| JoltGrabber.set_reference_angular_acceleration | JoltGrabber.set_reference_angular_acceleration(value) | Boolean; finite value, range 0.001..1000 rad/s² converted from input degrees, public unit °/s². Changes the controller, not held-body mass or transform. Throw max speed caps added velocity, not total velocity. |
| JoltGrabber.set_reference_rotation_speed | JoltGrabber.set_reference_rotation_speed(value) | Boolean; finite value, range 0.001..100 rad/s converted from input degrees, public unit °/s. Changes the controller, not held-body mass or transform. Throw max speed caps added velocity, not total velocity. |
| JoltGrabber.set_reference_speed | JoltGrabber.set_reference_speed(value) | Boolean; finite value, range 0.001..1000, public unit m/s. Changes the controller, not held-body mass or transform. Throw max speed caps added velocity, not total velocity. |
| JoltGrabber.set_rotate_button | JoltGrabber.set_rotate_button(button) | Boolean; integer mouse buttons 0..5 / keys 0..255. 0 disables action; defaults left, right, R, F. |
| JoltGrabber.set_rotation_speed | JoltGrabber.set_rotation_speed(value) | Boolean; finite value, range 0.001..100 rad/s converted from input degrees, public unit °/s. Changes the controller, not held-body mass or transform. Throw max speed caps added velocity, not total velocity. |
| JoltGrabber.set_snap_step | JoltGrabber.set_snap_step(value) | Boolean; 0 disables snap, otherwise 1..180° and must divide 360 into integral steps. |
| JoltGrabber.set_socket_pull_enabled | JoltGrabber.set_socket_pull_enabled(enabled) | Boolean result; Boolean or exact 0/1 input, default false. Preserve acquired distance / automatic upright / yaw following / pulling breakable Sockets according to name. |
| JoltGrabber.set_strength | JoltGrabber.set_strength(value) | Boolean; finite value, range 0.001..100000000, public unit N. Changes the controller, not held-body mass or transform. Throw max speed caps added velocity, not total velocity. |
| JoltGrabber.set_throw_impulse | JoltGrabber.set_throw_impulse(impulse) | Boolean; finite nonnegative impulse in N·s, default 100; used by automatic controls. |
| JoltGrabber.set_throw_key | JoltGrabber.set_throw_key(key) | Boolean; integer mouse buttons 0..5 / keys 0..255. 0 disables action; defaults left, right, R, F. |
| JoltGrabber.set_throw_max_speed | JoltGrabber.set_throw_max_speed(value) | Boolean; finite value, range 0..1000, public unit m/s. Changes the controller, not held-body mass or transform. Throw max speed caps added velocity, not total velocity. |
| JoltGrabber.set_unlock_physics_locked | JoltGrabber.set_unlock_physics_locked(enabled) | Boolean result; Boolean or exact 0/1. Ignore collision with holder / allow unlocking physics_locked on grab; default false. |
| JoltGrabber.set_up | JoltGrabber.set_up(x,y,z) | World nonzero finite Up vector; setter Boolean, getter {x, y, z} or undefined. |
| JoltGrabber.set_yaw_follow | JoltGrabber.set_yaw_follow(value) | Boolean result; Boolean or exact 0/1 input, default false. Preserve acquired distance / automatic upright / yaw following / pulling breakable Sockets according to name. |
| JoltGrabber.throw_body | JoltGrabber.throw_body(impulse) | Boolean; nonnegative impulse N·s along view direction followed by release. Added speed is limited by throw_max_speed; existing momentum is preserved. |
| JoltGrabber.update | JoltGrabber.update(ox,oy,oz,dx,dy,dz) | Boolean; world origin in m and direction vector (not a Target point). update_frame adds nonzero independent Up, preserves roll and orthonormalizes the frame. update derives dt from delta_time; neither is a simulation step. |
| JoltGrabber.update_controls | JoltGrabber.update_controls() | Boolean; once in End Step after camera. Automatically handles grab/release/rotate/realign/scroll/throw; invalid or unlocked camera releases. Requires carry profile. |
| JoltGrabber.update_frame | JoltGrabber.update_frame(ox,oy,oz,dx,dy,dz,ux,uy,uz) | Boolean; world origin in m and direction vector (not a Target point). update_frame adds nonzero independent Up, preserves roll and orthonormalizes the frame. update derives dt from delta_time; neither is a simulation step. |