A newer version of Max is available. Click here to access the latest version of the documentation

jit.phys.ghost Reference

A collision sensor and forcefield

jit.phys.ghost

Description

The jit.phys.ghost object represents a sensor area defined by a basic collision shape in a physics world. The collision shape is either one of several simple shapes. Additionally a force field can be enabled to act on colliding objects. The direction vector of the force field can be either in world coordinates, or relative to the jit.phys.ghost object.

Examples

A collision sensor and forcefield

Attributes

central_exp [float]

Adjust the exponent of the central force scaling curve if central_mode is decrease or increase . The default of 1 gives a linear curve, greater than one exponential, and less than one logarithmic.

central_force [float]

Apply a central force

central_mode [symbol]

Specifies how rigid body distance from center affects the central force when enabled by central_force (default = decrease).

Possible values:

'constant' ( Distance has no effect on central force )
'decrease' ( Central force decreases with distance )
'increase' ( Central force increases with distance )

collision_mode [symbol]

Specifies the format of the collisions dictionary (default = simple)

Possible values:

'simple' ( Report contact point positions and normals average )
'complete' ( All contact point position and normals reported )

collisions [int]

Enables and disables collision dictionary reporting out the first outlet.

enable [int]

Enable this ghost object in the physics simulation (default = 1).

filters [10 symbols]

The list of names that determine colliding objects for this ghost object; Valid attributes are all and default . Additional valid attributes are defined by the colliding objects' filterclass attribute.

force [3 floats]

Apply a force to the colliding rigid bodies using the vector from the ghost object center to the rigid body center, scaled by amount . If amount is positive, bodies shoot away from the ghost center, if negative they are pulled into the ghost center.

name [symbol]

Specifies the name of the instance (default = UID).

position [3 floats]

Ghost object in worldspace in the form x y z (default = 0. 0. 0.).

quat [4 floats]

Ghost object orientation as a quaternion in the form x y z w (default = 0. 0. 0. 1.).

rotate [4 floats]

Ghost object orientation as angle-axis in the form angle(in degrees) x y z (default = 0. 0. 0. 1.).

rotate_order [symbol]

Sets the order of rotations that are applied to the rotatexyz attribute for all child gl objects (default = auto). E.G. if set to xyz , the object is first rotated around its X axis, then Y, and finally Z. The default value, 'auto', implements yzx ordering.

Possible values:

'auto'
'xyz'
'xzy'
'yxz'
'yzx'
'zxy'
'zyx'

rotatexyz [3 floats]

Ghost object orientation as Euler angles (in degrees) in the form x y z (default = 0. 0. 0.).

scale [3 floats]

The Ghost object scaling factor in the form x y z (default = 1. 1. 1.). Cannot be applied to concave shapes.

shape [symbol]

Collision shape type (default = sphere).

Possible values:

'sphere'
'cube'
'capsule'
'cone'
'cylinder'
'convexhull'
'concave'
'dynamicmesh'

torque [3 floats]

Apply a torque (angular force) to the colliding bodies using a 3D worldspace vector (default = 0 0 0).

worldname [symbol]

The name of a jit.phys.world context this ghost object is bound to.

Common Box Attributes

Messages

bang

Update ghost forces and output collision dict

central_impulse

Arguments

amount [float]
Apply an impulse (instantaneous force) to the colliding rigid bodies using the vector from the ghost object center to the rigid body center, scaled by amount . If amount is positive, bodies shoot away from the ghost center, if negative they are pulled into the ghost center. Impulse strength is inversely proportional to the distance between objects.

impulse

Arguments

x [float]
y [float]
z [float]
relative-x [float]
relative-y [float]
relative-z [float]
Apply an impulse (instantaneous force) to the colliding rigid bodies using a worldspace vector described by x , y , z . Optional args relative-x , relative-y , relative-z describe a relative position on the body where the force is applied, otherwise it's a central force.

reset

Clear all forces

torque_impulse

Arguments

x [float]
y [float]
z [float]
Apply a torque impulse (instantaneous angular force) to the colliding rigid bodies using a worldspace vector described by x , y , z .

See Also

Name Description
Working with OpenGL Working with OpenGL
jit.phys.world
jit.phys.body
jit.phys.multiple
jit.phys.picker
jit.gl.physdraw