joint3d component
Joins this node's body to connected_body. kind is fixed, hinge, slider, ball_socket, rope, spring or generic; both ends need a body3d on or above the…
På denne siden
3d · physics · 29 properties · 3D
Joins this node's body to connected_body. kind is fixed, hinge, slider, ball_socket, rope, spring or generic; both ends need a body3d on or above the node. axes limits and drives each free axis.
In a scene, joint3d is the node key that applies it. A script reaches each property below as a field on node.joint3d: reading one asks the running component, and assigning one leaves the rest alone. The whole table is node.joint3d.get() and node.joint3d.set(table).
Properties
| property | type | default | description |
|---|---|---|---|
anchor |
vec3 | [0,0,0] |
Where the joint attaches on this node, in its own space |
anchor_rotation |
vec3 | [0,0,0] |
Turns this end's joint frame about its own axes, x first: what a hinge's angle and its limits measure from, and the relative turn a fixed joint holds. Euler radians in the file |
articulation |
bool | false |
Solve in reduced coordinates: the chain never drifts and can be solved for inverse kinematics, but cannot close a loop or break |
axes |
list | [] |
One record per free axis to limit or drive. A rope's x takes no limits (max_length is its limit); a spring's x is its spring, whose motor stays off |
axis |
vec3 | [0,0,1] |
The joint frame's x axis: what a hinge turns about, a slider slides along, and a generic joint's x and rotation_x name |
break_force |
float | 0 |
The force, in newtons, that snaps the joint and calls on_joint_break; 0 never breaks. Does not apply to an articulation At least 0. |
break_torque |
float | 0 |
The torque about the anchor, in newton metres, that snaps the joint; 0 never breaks. Does not apply to an articulation At least 0. |
collide_connected |
bool | false |
Let the two joined bodies collide with each other |
connected_anchor |
vec3 | [0,0,0] |
Where it attaches on the other node, in that node's space |
connected_anchor_rotation |
vec3 | [0,0,0] |
The same for the other end's frame |
connected_axis |
vec3 | [0,0,0] |
The same axis in the other node's space, for a hinge, a slider or a generic joint; zero takes axis |
connected_body |
node | — | The node at the joint's other end; this node is the first end |
coupled_rotation |
flags | [] |
Free turning axes tied into one angle, whose limit and motor come from the first of them One of x, y, z. |
coupled_translation |
flags | [] |
Free linear axes tied into one distance, whose limit and motor come from the first of them; a rope and a spring couple all three already One of x, y, z. |
enabled |
bool | true |
Hold the two bodies together at all. Off keeps the joint and stops solving it; an articulation leaves its chain instead, as rapier's chains ignore the switch |
gear_offset |
float | 0 |
Where this joint stands when the gear_with joint is at 0 |
gear_ratio |
float | 1 |
How far this joint turns or slides per unit of the gear_with joint's |
gear_with |
node | — | On an articulation: another joint node of the same chain this joint follows, its first free axis tied to that joint's first free axis |
kind |
enum | fixed |
How the two bodies may move relative to each other One of fixed, hinge, slider, ball_socket, rope, spring, generic. |
kinematic_link |
bool | false |
On an articulation: the solver never changes this joint's velocity, so the link holds its pose against its parent and moves only by solve_ik |
lock_rotation |
flags | [] |
The axes a generic joint may not turn about One of x, y, z. |
lock_translation |
flags | [] |
The axes a generic joint may not slide along One of x, y, z. |
max_length |
float | 0 |
The rope's greatest length At least 0. |
passive_rest |
float | 0 |
On an articulation: where that spring rests, in radians about a rotation axis and units along a linear one |
passive_stiffness |
float | 0 |
On an articulation: a spring on each free axis pulling it towards passive_rest; 0 is none At least 0. |
rest_length |
float | 0 |
The length a spring pulls back to At least 0. |
self_collision |
bool | true |
On an articulation: let the chain's links collide with each other. One setting for the whole chain, off when any of its joints says off |
softness_damping_ratio |
float | 1 |
The damping ratio of that spring; 1 settles without overshooting At least 0. |
softness_hz |
float | 1000000 |
How stiffly the joint's locked axes and limits are held, as a spring frequency in hertz; lower lets them stretch and spring back At least 0. |
Script functions
Methods of node.joint3d, the handle a node carrying this component exposes. Every handle also has get(), set(table), patch(table), has() and remove().
From physics3d:
| method | what it does |
|---|---|
joint_force() -> any |
The force and the torque the joint held through the last step, #{ force, torque }: what break_force and break_torque are measured against. An articulation has none to read, and says so. |
joint_state() -> any |
What the joint is doing: #{ status, angle, limit_impulses, motor_impulses, coordinates, velocities }. status is enabled, disabled, body_disabled (a body at either end is disabled) or waiting (its other end is not in the scene yet); angle is a hinge's turn in radians; the impulse maps hold each free axis's last limit and motor impulse; an articulation adds each free axis's coordinate and velocity. |
remove_joint() |
Undo the node's joint, leaving both bodies free. |
set_joint_limits(string, float, float) |
Set how far one of the joint's free axes may travel, in radians about a rotation axis and units along a linear one; equal values lift the limit. Rewrites that axis's axes record. |
set_motor_position(string, float, float, float) |
Drive one of the joint's free axes towards an angle or a distance, with a spring's stiffness and damping. Rewrites that axis's axes record. |
set_motor_velocity(string, float, float) |
Drive one of the joint's free axes towards a speed: how a wheel is powered or a door swings itself shut. Rewrites that axis's axes record. |
solve_ik(float, float, float, any?) |
Move a reduced-coordinates chain so its last link reaches a world position, leaving every joint inside its limits. Options: rotation (euler radians to turn the link to), constrain (the world axes to match: x, y, z, rotation_x, rotation_y, rotation_z; the translation by default, every axis when rotation is given), damping (1.0), iterations (10), tolerance (0.001). |