Scene kit command
physics.constraint.add
Add Rigid Body Constraint
Adds a rigid body constraint (fixed, hinge, slider, spring, motor, …) between two objects. A motor independently drives translation and rotation on the constraint X axis.
- Kit
- Scene 0.1.0 (.kscene)
- Changes the document
- yes
- Acts on
objects(a list of ids), which a run step’sonfills
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
angleLimit | any[] | no | Hinge: [lower, upper] in degrees about Z, or null for none |
angularLimits | any[] | no | Generic spring: per axis X, Y, Z a [lower, upper] in degrees, or null for free |
angularMaxImpulse | number | no | Motor: maximum angular impulse control, 0 to 1000000000 (default 1); step impulse is value times seconds |
angularMotor | boolean | no | Motor: enable rotation about the constraint's X axis (default false) |
angularSprings | any[] | no | Generic spring: per axis X, Y, Z a stiffness in N·m/rad, or null for none |
angularTargetVelocity | number | no | Motor: body 1 relative to body 2 in rad/s, -100000 to 100000 (default 1) |
breakable | boolean | no | The constraint breaks when it must push harder than the threshold |
breakingThreshold | number | no | The impulse (N·s) in one step that breaks it |
disableCollisions | boolean | no | The joined bodies pass through each other (default true) |
distanceLimit | any[] | no | Slider: [lower, upper] in metres along X, or null for none |
enabled | boolean | no | The constraint acts |
linearLimits | any[] | no | Generic spring: per axis X, Y, Z a [lower, upper] in metres, or null for free |
linearMaxImpulse | number | no | Motor: maximum linear impulse control, 0 to 1000000000 (default 1); step impulse is value times seconds |
linearMotor | boolean | no | Motor: enable translation along the constraint's X axis (default false) |
linearSprings | any[] | no | Generic spring: per axis X, Y, Z a stiffness in N/m, or null for none |
linearTargetVelocity | number | no | Motor: body 1 relative to body 2 in m/s, -100000 to 100000 (default 1) |
object1 | integer | string | no | The first rigid body joined |
object2 | integer | string | no | The second rigid body joined |
objects | integer | string | (integer | string)[] | no | The objects; the selection when left out |
pick | number[] | no | Instead of `object`/`objects`: a world point [x, y, z] in metres; the command acts on the object there now (the smallest whose mesh's bounds hold the point, else the nearest light, camera, empty, curve, text, lattice or armature whose origin is within 0.25 m). A place: with `basis`, a write by it is refused when what is at the point is no longer what was there (moved away, another moved in, its parent moved) |
springDamping | number | no | Generic spring: the springs' damping |
type | "fixed" | "point" | "hinge" | "slider" | "genericSpring" | "motor" | no | fixed: one piece; point: a ball joint; hinge: turns about Z; slider: slides along X; genericSpring: per axis limits and springs; motor: drives along/about X |
Call through scene_run
scene_run {
"path": "<file>.kscene",
"steps": [{ "command": "physics.constraint.add" }]
}The required parameters, with placeholders for their types: not a tested example. Optional: angleLimit, angularLimits, angularMaxImpulse, angularMotor, angularSprings, angularTargetVelocity, breakable, breakingThreshold, disableCollisions, distanceLimit, enabled, linearLimits, linearMaxImpulse, linearMotor, linearSprings, linearTargetVelocity, object1, object2, objects, pick, springDamping, type. scene_run answers the step’s result in completed[i].result.
Result
The kit gives no result schema for this command.
Parameter schema
{
"additionalProperties": false,
"properties": {
"angleLimit": {
"description": "Hinge: [lower, upper] in degrees about Z, or null for none",
"type": "array"
},
"angularLimits": {
"description": "Generic spring: per axis X, Y, Z a [lower, upper] in degrees, or null for free",
"type": "array"
},
"angularMaxImpulse": {
"description": "Motor: maximum angular impulse control, 0 to 1000000000 (default 1); step impulse is value times seconds",
"type": "number"
},
"angularMotor": {
"description": "Motor: enable rotation about the constraint's X axis (default false)",
"type": "boolean"
},
"angularSprings": {
"description": "Generic spring: per axis X, Y, Z a stiffness in N·m/rad, or null for none",
"type": "array"
},
"angularTargetVelocity": {
"description": "Motor: body 1 relative to body 2 in rad/s, -100000 to 100000 (default 1)",
"type": "number"
},
"breakable": {
"description": "The constraint breaks when it must push harder than the threshold",
"type": "boolean"
},
"breakingThreshold": {
"description": "The impulse (N·s) in one step that breaks it",
"type": "number"
},
"disableCollisions": {
"description": "The joined bodies pass through each other (default true)",
"type": "boolean"
},
"distanceLimit": {
"description": "Slider: [lower, upper] in metres along X, or null for none",
"type": "array"
},
"enabled": {
"description": "The constraint acts",
"type": "boolean"
},
"linearLimits": {
"description": "Generic spring: per axis X, Y, Z a [lower, upper] in metres, or null for free",
"type": "array"
},
"linearMaxImpulse": {
"description": "Motor: maximum linear impulse control, 0 to 1000000000 (default 1); step impulse is value times seconds",
"type": "number"
},
"linearMotor": {
"description": "Motor: enable translation along the constraint's X axis (default false)",
"type": "boolean"
},
"linearSprings": {
"description": "Generic spring: per axis X, Y, Z a stiffness in N/m, or null for none",
"type": "array"
},
"linearTargetVelocity": {
"description": "Motor: body 1 relative to body 2 in m/s, -100000 to 100000 (default 1)",
"type": "number"
},
"object1": {
"description": "The first rigid body joined",
"oneOf": [
{
"description": "the object's id",
"type": "integer"
},
{
"description": "the object's name",
"type": "string"
}
],
"x-khp-name": "name",
"x-khp-types": [
"Object"
]
},
"object2": {
"description": "The second rigid body joined",
"oneOf": [
{
"description": "the object's id",
"type": "integer"
},
{
"description": "the object's name",
"type": "string"
}
],
"x-khp-name": "name",
"x-khp-types": [
"Object"
]
},
"objects": {
"description": "The objects; the selection when left out",
"oneOf": [
{
"description": "an object's id",
"type": "integer"
},
{
"description": "an object's name",
"type": "string"
},
{
"description": "ids or names",
"items": {
"oneOf": [
{
"type": "integer"
},
{
"type": "string"
}
]
},
"type": "array"
}
],
"x-khp-name": "name",
"x-khp-types": [
"Object"
]
},
"pick": {
"description": "Instead of `object`/`objects`: a world point [x, y, z] in metres; the command acts on the object there now (the smallest whose mesh's bounds hold the point, else the nearest light, camera, empty, curve, text, lattice or armature whose origin is within 0.25 m). A place: with `basis`, a write by it is refused when what is at the point is no longer what was there (moved away, another moved in, its parent moved)",
"items": {
"type": "number"
},
"type": "array"
},
"springDamping": {
"description": "Generic spring: the springs' damping",
"type": "number"
},
"type": {
"description": "fixed: one piece; point: a ball joint; hinge: turns about Z; slider: slides along X; genericSpring: per axis limits and springs; motor: drives along/about X",
"enum": [
"fixed",
"point",
"hinge",
"slider",
"genericSpring",
"motor"
],
"type": "string"
}
},
"type": "object"
}Generated from the command list of @kition/[email protected] and the kit itself (scene_commands through @kition/[email protected], built from KitionAI/kition-scene@4d06faf). As data: commands.jsonl.