Mounting, Size and Rendering
Place a control relative to the world or a body and display its actual movement without reconstructing its angle.
| Item | Meaning / default |
|---|---|
| parent | Default undefined: world mount. Otherwise a valid JoltBody in the same managed world; Static, Kinematic and Dynamic are supported. |
| position / rotation | Without a parent: world point {x:0,y:0,z:0} and quaternion {x:0,y:0,z:0,w:1}. |
| local_position / local_rotation | With a parent: the same defaults in its local space. Do not combine with world fields. |
| mass / size | Positive mass and dimensions; each type page lists its defaults. Recreate the control to change geometry or travel. |
| resistance / output | Default resistance 0. Output 0..1 without inversion; joystick −1..1 on each axis. |
The world is right-handed and Z-up. A local mount is relative to the parent's public origin, not its centre of mass. A valid nonzero quaternion is normalized. Creation on a moving parent inherits its local velocity field. The mechanism suppresses collisions between the control and its parent; contacts with other bodies still follow their layers.
Example#
var panel = jolt_box_create_static(0, 0, 1, 2, 1, 0.1);
var lever = jolt_control_lever({
parent: panel,
local_position: {x: 0.4, y: 0, z: 0.06},
local_rotation: {x: 0, y: 0, z: 0, w: 1},
size: {x: 0.08, y: 0.08, z: 0.5}
});Moving part and base#
get_transform() returns {position:{x,y,z}, rotation:{x,y,z,w}} for the moving body's world pose. get_base_transform() returns the current mounting frame in the same format. Lever and Joystick have their moving origin at the rod centre, Pedal at the plate centre. Crank has its origin at the pivot but an off-axis centre of mass. Match the mesh's local origin or compose a model offset with the transform.
// End Step: lever_instance is registered with the BBMOD renderer.
var pose = lever.get_transform();
if (!is_undefined(pose)) {
lever_instance.Matrix = model_matrix_from_transform(pose.position, pose.rotation);
}New related workflows#
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 |
|---|---|---|
| JoltControl.get_base_transform | JoltControl.get_base_transform() | World transform of moving part / mounting frame {position m, rotation XYZW}; undefined on error. Includes parent transform. |
| JoltControl.get_transform | JoltControl.get_transform() | World transform of moving part / mounting frame {position m, rotation XYZW}; undefined on error. Includes parent transform. |