jit.phys.multiple
Description
The jit.phys.multiple object uses several jit.matrix objects to simulate rigid bodies in a physics world. The two outlets connect to the position and rotate matrix inputs of a jit.gl.multiple object allowing for easy visualization of the rigid body shapes.
Examples
Discussion
Settable parameters include position, rotation, rotatexyz, scale, mass, friction, restitution, damping, force, torque, and mesh. All parameters take float32 matrices. Parameter matrices can be of differing dim sizes, and will wrap to the dimensions of the matrix specified by the dimparam attribute (except for mesh).
Attributes
constraint [symbol]
Specifies a constraint type to be used for the internal constraint matrix (default=none). When set, constraints are automatically created halfway between each rigid body and its nearest neighbor, along each dimension of the position matrix.
Possible values:
'none'
'point2point'
'hinge'
'barslide'
'conetwist'
'6dof'
constraint_matrix [int]
Enable reporting of constraint positions as a jit_matrix (default = 0)
constraintoutname [symbol]
Constraint output matrix name
damping [2 floats]
Set the linear and angular damping applied to a body in the range 0. to 1. (default 0.2 0.2). Damping can be used to simulate air resistance.
enable [int]
Enable bodies in the physics simulation (default = 1).
enable_sleep [int]
Enable sleeping on all bodies, causing deactivation when linear and angular velocity are 0 (default = 0).
filterclass [symbol]
Set the name of this object's collision filter-class (default = default). Other objects must specify the filterclass name in their filters list to enable collisions with this object. Maximum allowed unique names is 10.
filters [10 symbols]
Specify a list of filterclass names to enable collisions with (default = all). Possible values include all , worldbox , and default . Additional values include any user-specified filterclass names (maximum allowed = 10).
force [3 floats]
Apply a force to the rigid bodies using a 3D worldspace vector (default = 0 0 0). If forces_relative is enabled, the vector is converted to object space.
forces_relative [int]
Forces relative flag will cause all forces to be converted to object space before applying (default = 0).
friction [float]
The friction amount (opposite force) (default = 0.5). Applied when the body is in contact with another body that has friction.
kinematic [int]
Kinematic flag (default = 1). Use this mode to disable dynamics on the bodies, enable collisions, and animate using position and rotate matrices.
local_scaling [int]
Local scaling flag (default = 0). When enabled, the scale attribute will apply a local scaling transform to the collision shape. When disabled, the rigid-body is removed and re-added to the physics world for every scale modification.
mass [float]
Body mass (default = 1.). When set to 0. body dynamics are disabled, however collisions remain active.
name [symbol]
Specifies the name of the instance (default = UID).
physparams [11 symbols]
The list of physics body attributes corresponding to object inlets that are modifiable by passing in a matrix. Valid attributes are position, rotation, rotatexyz, scale, mass, friction, restitution, damping, force, torque, and mesh.
posoutname [symbol]
Position output matrix name
reduce_hull [int]
Enable automatic vertex reduction when body shape attribute is set to (default = 1).
restitution [float]
Restitution value, or bounciness (default = 0.1). The proportion of kinetic energy preserved on impact with other rigid bodies.
rolling_friction [float]
The rolling friction amount (opposite force for a rolling object) (default = 0.0). Applied when the body is in contact with another body that has friction.
rotoutname [symbol]
Rotate output matrix name
shape [symbol]
Collision shape type (default = sphere).
Possible values:
'sphere'
'cube'
'capsule'
'cone'
'cylinder'
'convexhull'
(
A convex hull is generated that encloses the vertices specified by the mesh matrix.
)
'concave'
(
A concave shape is generated allowing for hollows in the shape, from the vertices specified by the mesh matrix.
)
'dynamicmesh'
shareshape [int]
Enable collision shape sharing among body instances (default = 0). When enabled, all rigid body instances will have uniform shape scaling, ignoring the scale matrix if present.
torque [3 floats]
Apply a torque (angular force) to the rigid bodies using a 3D worldspace vector (default = 0 0 0).
worldname [symbol]
The name of a jit.phys.world context the rigid bodies are bound to.
Common Box Attributes
annotation [symbol]
Sets the text that will be displayed in the Clue window when the user moves the mouse over the object.
background [int] (default: 0)
Adds or removes the object from the patcher's background layer.
adds the object to the background layer, removes it. Objects in the background layer are shown behind all objects in the default foreground layer.color [4 floats]
Sets the color for the object box outline.
fontface [int]
Sets the type style used by the object. The options are:
plain
bold
italic
bold italic
Possible values:
0 = 'regular'
1 = 'bold'
2 = 'italic'
3 = 'bold italic'
fontname [symbol]
Sets the object's font.
fontsize [float]
Sets the object's font size (in points).
Possible values:
'8'
'9'
'10'
'11'
'12'
'13'
'14'
'16'
'18'
'20'
'24'
'30'
'36'
'48'
'64'
'72'
hidden [int] (default: 0)
Toggles whether an object is hidden when the patcher is locked.
hint [symbol]
Sets the text that will be displayed in as a pop-up hint when the user moves the mouse over the object in a locked patcher.
ignoreclick [int] (default: 0)
Toggles whether an object ignores mouse clicks in a locked patcher.
jspainterfile [symbol]
JS Painter File
patching_rect [4 floats] (default: 0. 0. 100. 0.)
Sets the position and size of the object in the patcher window.
position [2 floats]
Sets the object's x and y position in both patching and presentation modes (if the object belongs to its patcher's presentation), leaving its size unchanged.
presentation [int] (default: 0)
Sets whether an object belongs to the patcher's presentation.
presentation_rect [4 floats] (default: 0. 0. 0. 0.)
Sets the x and y position and width and height of the object in the patcher's presentation, leaving its patching position unchanged.
rect [4 floats]
Sets the x and y position and width and height of the object in both patching and presentation modes (if the object belongs to its patcher's presentation).
size [2 floats]
Sets the object's width and height in both patching and presentation modes (if the object belongs to its patcher's presentation), leaving its position unchanged.
textcolor [4 floats]
Sets the color for the object's text in RGBA format.
textjustification [int]
Sets the justification for the object's text.
Possible values:
0 = 'left'
1 = 'center'
2 = 'right'
varname [symbol]
Sets the patcher's scripting name, which can be used to address the object by name in pattr, scripting messages to thispatcher, and the js object.
Messages
bang
damping_matrix
Arguments
force_matrix
Arguments
friction_matrix
Arguments
getconstraint_dict
impulse
Arguments
y [float]
z [float]
relative-x [float]
relative-y [float]
relative-z [float]
mass_matrix
Arguments
mesh_matrix
Arguments
position_matrix
Arguments
reset
restitution_matrix
Arguments
rotate_matrix
Arguments
rotatexyz_matrix
Arguments
scale_matrix
Arguments
sendbody
Arguments
body-index (optional) [list]
message [symbol]
values [list]
sendbody_reset
Arguments
body-index (optional) [list]
message [symbol]
values [list]
sendconstraint
torque_impulse
Arguments
y [float]
z [float]
torque_matrix
Arguments
See Also
Name | Description |
---|---|
Working with OpenGL | Working with OpenGL |
jit.phys.world | Collision detection and rigid body dynamics |
jit.phys.body | A rigid body and collision shape |
jit.phys.ghost | A collision sensor and forcefield |
jit.phys.picker | Constraint picking in a physics world |
jit.gl.physdraw | A physics opengl debug drawer |
jit.gl.multiple | Create multiple object instances |
jit.gl.gridshape | Generate simple geometric shapes as a grid |