jit.phys.picker
Description
The jit.phys.picker object responds to mouse clicks and drags in the destination by creating a constraint on jit.phys.body objects intersecting with the mouse. Multi-touch picking is facilitated by the message.
Examples
Discussion
When an intersection occurs, the jit.phys.body name and current mouse-state is sent out the leftmost outlet. If dynamics is enabled, a point-to-point constraint is created on the picked body that persists until the mouse button is released. When dragging a rigid-body with dynamics enabled, holding down the option key will move the object towards and away from the camera. If the option key is held and the mouse is released, the constraint will persist, allowing the mouse to be repositioned on the rigid-body.
Attributes
dynamics [int]
Enable/disable dynamic constraint picking intersecting bodies (default = 1).
enable [int]
Enable the picker contraint and ray-testing in the physics simulation (default = 1).
filterclass [symbol]
Set the name of this object's collision filter-class (default = default). Other objects most 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 and default . Additional values include any user-specified filterclass names (maximum allowed = 10).
hover [int]
Enable/disable mouse hovering allowing for picking without the mouse button down (default = 0).
local_position [3 floats]
The local-space constraint position on the picked body (default = 0 0 0).
output_positions [int]
Enable/disable the output of local and world position values when an object is selected(default = 0). When enabled the local position on the clicked object, and the world-space position of the constraint are output following the object name and mouse-state.
pickmode [symbol]
Determines how the constraint is applied to the intersecting body (default = surface).
Possible values:
'center'
(
The constraint is applied to the bodies center of mass
)
'surface'
(
The constraint is applied to the intersecting surface point
)
position [3 floats]
The current constraint picking position (default = 0 0 0).
strength [float]
Set the constraint strength (default = 0.2). Determines what proportion of the joint error will be fixed each simulation step. Values between 0.1 and 0.8 are recommended.
stretch [float]
Set the constraint stretch (default = 0.0). Setting to a positive value allows forces acting on rigid bodies to violate the constraint by an amount proportional to the stretch value.
ui_priority [int]
UI priority value (default = -800). When multiple UI objects are listening to the same window, ui_priority determines the order objects receive input. Lower values test first.
worldname [symbol]
The name of a jit.phys.world context this constraint picker is 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
touch
Arguments
down [long]
screen-x [long]
screen-y [long]
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.gl.picker | Mouse picking in an opengl context |