<?xml version="1.0" encoding="utf-8" standalone="yes"?>

<?xml-stylesheet href="./_c74_ref.xsl" type="text/xsl"?>

<!--This is an automatically generated file. DO NOT EDIT THIS FILE DIRECTLY. Rather, use the _ref.xml files found in the 'edits' folder.-->
<c74object name="jit.phys.world" module="jit" category="Jitter Physics">
	<digest>
		Collision detection and rigid body dynamics
	</digest>
	<description>
		The <o>jit.phys.world</o> object encapsulates a physics simulation context to perform collision detection and rigid body dynamics on its child objects. Other physics objects in the same patch as a <o>jit.phys.world</o> object are automatically added to the world. Multiple contexts can be managed by explicitly setting the <at>name</at> attribute of the <o>jit.phys.world</o> object and the <at>worldname</at> attribute of the child physics objects. Dynamics can be disabled, allowing the world to be used solely for collision detections. A 2D simulation is achieved with the <at>remove_plane</at> attribute.
	</description>
	<!--METADATA-->
	<metadatalist>
		<metadata name="author">
			Cycling '74
		</metadata>
		<metadata name="tag">
			Jitter
		</metadata>
	</metadatalist>
	<!--INLETS-->
	<inletlist>
		<inlet id="0" type="INLET_TYPE">
			<digest>
				messages in
			</digest>
			<description>
				TEXT_HERE
			</description>
		</inlet>
		<inlet id="1" type="INLET_TYPE">
			<digest>
			</digest>
			<description>
				TEXT_HERE
			</description>
		</inlet>
	</inletlist>
	<!--OUTLETS-->
	<outletlist>
		<outlet id="0" type="OUTLET_TYPE">
			<digest>
				collision list
			</digest>
			<description>
				TEXT_HERE
			</description>
		</outlet>
		<outlet id="1" type="OUTLET_TYPE">
			<digest>
				dumpout
			</digest>
			<description>
				TEXT_HERE
			</description>
		</outlet>
	</outletlist>
	<!--MESSAGES-->
	<methodlist>
		<method name="bang">
			<arglist />
			<digest>
				Perform a single step of the physics simulation, test and report collisions, and update all child objects.
			</digest>
			<description>
				Causes the world to perform a single step of the physics simulation, test and report collisions, and update all child objects.
			</description>
		</method>
		<method name="raytest">
			<arglist>
				<arg name="x-from" type="float" />
				<arg name="y-from" type="float" />
				<arg name="z-from" type="float" />
				<arg name="x-to" type="float" />
				<arg name="y-to" type="float" />
				<arg name="z-to" type="float" />
			</arglist>
			<digest>
				Perform ray-testing on rigid bodies and report the colliding objects
			</digest>
			<description>
				Perform ray-testing on the rigid bodies using the passed in ray endpoints, and report colliding objects out the right-hand (dumpout) outlet of the object, followed by the relative intersection position and world-space intersection. See <at>raytest_mode</at> for more info.
			</description>
		</method>
		<method name="reset">
			<arglist />
			<digest>
				Reset the simulation including dynamic and kinematic rigid bodies
			</digest>
			<description>
				Reset the simulation including dynamic and kinematic rigid bodies.
			</description>
		</method>
		<method name="screenraytest">
			<arglist>
				<arg name="screen-x" type="float" />
				<arg name="screen-y" type="float" />
			</arglist>
			<digest>
				Perform ray-testing on rigid bodies and report the colliding objects
			</digest>
			<description>
				Perform ray-testing on the rigid bodies using the passed in screen coords. The ray start point is taken by converting the screen coords to world-space, and the end point is generated by casting a ray from the camera position, through the start point to the camera far clip plane. The colliding objects name is reported out the right-hand (dumpout) outlet of the object, followed by the relative intersection position and world-space intersection. See <at>raytest_mode</at> for more info.
			</description>
		</method>
	</methodlist>
	<jittermethodlist>
		<jittermethod name="exportattrs" />
		<jittermethod name="exportsummary" />
		<jittermethod name="getattributes" />
		<jittermethod name="getstate" />
		<jittermethod name="importattrs" />
		<jittermethod name="summary" />
	</jittermethodlist>
	<!--ATTRIBUTES-->
	<attributelist>
		<attribute name="automatic" get="1" set="1" type="int" size="1">
			<digest>
				Automatic mode enable
			</digest>
			<description>
				Enables and disables automatic mode where update messages are received from that target <o>jit.gl.render</o> object (default = 1).
			</description>
			<attributelist>
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Automatic" />
				<attribute name="style" get="1" set="1" type="symbol" size="1" value="onoff" />
			</attributelist>
		</attribute>
		<attribute name="collision_mode" get="1" set="1" type="symbol" size="1">
			<digest>
				Specifies the format of the collisions dictionary
			</digest>
			<description>
				Specifies the format of the collisions dictionary (default = simple)
			</description>
			<attributelist>
				<attribute name="category" get="1" set="1" type="atom" size="1" value="World-Collisions" />
				<attribute name="enumvals" get="1" set="1" type="atom" size="2">
					<enumlist>
						<enum name="simple">
							<digest>
								Report contact point positions and normals average
							</digest>
							<description>
								TEXT_HERE
							</description>
						</enum>
						<enum name="complete">
							<digest>
								All contact point position and normals reported
							</digest>
							<description>
								TEXT_HERE
							</description>
						</enum>
					</enumlist>
				</attribute>
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Collision Mode" />
				<attribute name="style" get="1" set="1" type="symbol" size="1" value="enum" />
			</attributelist>
		</attribute>
		<attribute name="collisions" get="1" set="1" type="int" size="1">
			<digest>
				Collision reporting enable
			</digest>
			<description>
				Enables and disables collision reporting out the second (dumpout) outlet.
			</description>
			<attributelist>
				<attribute name="category" get="1" set="1" type="atom" size="1" value="World-Collisions" />
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Collisions" />
				<attribute name="style" get="1" set="1" type="symbol" size="1" value="onoff" />
			</attributelist>
		</attribute>
		<attribute name="drawto" get="1" set="1" type="symbol" size="1">
			<digest>
				Assign to named drawing context.
			</digest>
			<description>
				Assign to the named drawing context, allowing for updates to be received automatically.
			</description>
			<attributelist>
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Drawto" />
			</attributelist>
		</attribute>
		<attribute name="dynamics" get="1" set="1" type="int" size="1">
			<digest>
				Rigid-body dynamics enable
			</digest>
			<description>
				Enables and disables rigid-body dynamics.
			</description>
			<attributelist>
				<attribute name="category" get="1" set="1" type="atom" size="1" value="World-Dynamics" />
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Dynamics" />
				<attribute name="style" get="1" set="1" type="symbol" size="1" value="onoff" />
			</attributelist>
		</attribute>
		<attribute name="enable" get="1" set="1" type="int" size="1">
			<digest>
				Enable simulation
			</digest>
			<description>
				Enable the physics simulation for all objects in this physics context (default = 1).
			</description>
			<attributelist>
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Enable" />
				<attribute name="style" get="1" set="1" type="symbol" size="1" value="onoff" />
			</attributelist>
		</attribute>
		<attribute name="fixedtimestep" get="1" set="1" type="int" size="1">
			<digest>
				Fixed time step value (Hz) of physics simulation
			</digest>
			<description>
				Fixed time step value (Hz) of physics simulation (default = 60). Increasing this value increases the resolution of the simulation.
			</description>
			<attributelist>
				<attribute name="category" get="1" set="1" type="atom" size="1" value="World-Dynamics" />
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Fixed Timestep" />
			</attributelist>
		</attribute>
		<attribute name="gravity" get="1" set="1" type="float" size="3">
			<digest>
				The force of gravity
			</digest>
			<description>
				A 3D vector describes the force of gravity applied to all objects in the world (default = 0, -9.8, 0).
			</description>
			<attributelist>
				<attribute name="category" get="1" set="1" type="atom" size="1" value="World-Properties" />
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Gravity" />
			</attributelist>
		</attribute>
		<attribute name="maxsubsteps" get="1" set="1" type="int" size="1">
			<digest>
				Maximum number of internal simulation steps between updates
			</digest>
			<description>
				Maximum number of internal simulation steps between updates (default = 1). Increase this number if FPS is low in order to prevent the simulation from losing time.
			</description>
			<attributelist>
				<attribute name="category" get="1" set="1" type="atom" size="1" value="World-Dynamics" />
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Max Substeps" />
			</attributelist>
		</attribute>
		<attribute name="name" get="1" set="1" type="symbol" size="1">
			<digest>
				Instance name
			</digest>
			<description>
				Specifies the name of the instance (default = UID).
			</description>
			<attributelist>
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Name" />
			</attributelist>
		</attribute>
		<attribute name="numcollisions" get="1" set="0" type="int" size="1">
			<digest>
				Number of collision points
			</digest>
			<description>
				Specifies the number of collision points in the world.
			</description>
			<attributelist>
				<attribute name="category" get="1" set="1" type="atom" size="1" value="World-Collisions" />
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Num Collisions" />
			</attributelist>
		</attribute>
		<attribute name="numthreads" get="1" set="1" type="int" size="1">
			<digest>
				Sets the number of collison dispatcher threads
			</digest>
			<description>
				Sets the number of collison dispatcher threads (default = 1). Increasing the number of threads may improve performance, especially for physics scenes with distinct and separate groups of colliding objects.
			</description>
			<attributelist>
				<attribute name="category" get="1" set="1" type="atom" size="1" value="World-Dynamics" />
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Number Threads" />
			</attributelist>
		</attribute>
		<attribute name="raytest_mode" get="1" set="1" type="symbol" size="1">
			<digest>
				Specifies how raytest messages return object hits
			</digest>
			<description>
				Specifies how raytest messages return object hits for the <m>raytest</m> and <m>screenraytest</m> messages (default = closest)
			</description>
			<attributelist>
				<attribute name="enumvals" get="1" set="1" type="atom" size="2">
					<enumlist>
						<enum name="closest">
							<digest>
								Return only the object closest to the camera
							</digest>
							<description>
								TEXT_HERE
							</description>
						</enum>
						<enum name="all">
							<digest>
								Return all intersecting objects
							</digest>
							<description>
								TEXT_HERE
							</description>
						</enum>
					</enumlist>
				</attribute>
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Ray Test Mode" />
				<attribute name="style" get="1" set="1" type="symbol" size="1" value="enum" />
			</attributelist>
		</attribute>
		<attribute name="remove_plane" get="1" set="1" type="int" size="1">
			<digest>
				Remove plane to enable 2D simulation
			</digest>
			<description>
				Remove plane to enable 2D simulation (default = none).
			</description>
			<attributelist>
				<attribute name="category" get="1" set="1" type="atom" size="1" value="World-Properties" />
				<attribute name="enumvals" get="1" set="1" type="atom" size="4">
					<enumlist>
						<enum name="none">
							<digest>
								TEXT_HERE
							</digest>
							<description>
								TEXT_HERE
							</description>
						</enum>
						<enum name="x">
							<digest>
								Constrain simulation to Y and Z planes
							</digest>
							<description>
								TEXT_HERE
							</description>
						</enum>
						<enum name="y">
							<digest>
								Constrain simulation to X and Z planes
							</digest>
							<description>
								TEXT_HERE
							</description>
						</enum>
						<enum name="z">
							<digest>
								Constrain simulation to X and Y planes
							</digest>
							<description>
								TEXT_HERE
							</description>
						</enum>
					</enumlist>
				</attribute>
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Remove Plane" />
				<attribute name="style" get="1" set="1" type="symbol" size="1" value="enumindex" />
			</attributelist>
		</attribute>
		<attribute name="split_impulse" get="1" set="1" type="int" size="1">
			<digest>
				Split impulse enable
			</digest>
			<description>
				Enables and disables split impulse dynamics (default = 1). When enabled, split impulse will allow the dynamics solver to apply positional corrections when deep collision penetrations occur.
			</description>
			<attributelist>
				<attribute name="category" get="1" set="1" type="atom" size="1" value="World-Dynamics" />
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Split Impulse" />
				<attribute name="style" get="1" set="1" type="symbol" size="1" value="onoff" />
			</attributelist>
		</attribute>
		<attribute name="targetname" get="1" set="1" type="symbol" size="1">
			<digest>
				jit.gl.render object name
			</digest>
			<description>
				Specifies the name of a <o>jit.gl.render</o> object to receive update messages from.
			</description>
			<attributelist>
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Target Name" />
			</attributelist>
		</attribute>
		<attribute name="worldbox" get="1" set="1" type="int" size="1">
			<digest>
				World bounds enable
			</digest>
			<description>
				Enables and disables the world bounds. (default = 1)
			</description>
			<attributelist>
				<attribute name="category" get="1" set="1" type="atom" size="1" value="World-Properties" />
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="World Box" />
				<attribute name="style" get="1" set="1" type="symbol" size="1" value="onoff" />
			</attributelist>
		</attribute>
		<attribute name="worldbox_scale" get="1" set="1" type="float" size="3">
			<digest>
				Change size and shape of world bounds
			</digest>
			<description>
				Changes the size and shape of the world bounds (default = 5, 5, 5).
			</description>
			<attributelist>
				<attribute name="category" get="1" set="1" type="atom" size="1" value="World-Properties" />
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="World Box Scale" />
			</attributelist>
		</attribute>
	</attributelist>
	<jitterattributelist />
	<!--EXAMPLE-->
	<examplelist>
		<example caption="Collision detection and rigid body dynamics" img="jit.phys.world.png" />
	</examplelist>
	<!--SEEALSO-->
	<seealsolist>
		<seealso name="jit.phys.body" />
		<seealso name="jit.phys.multiple" />
		<seealso name="jit.phys.ghost" />
		<seealso name="jit.phys.picker" />
		<seealso name="jit.gl.physdraw" />
	</seealsolist>
	<discussion>
		The physics engine maintains an internal timer for simulation steps that decouples the physics step frequency from the rendering frame rate. The <at>fixedtimestep</at> attribute controls the physics engine frequency, and the <at>maxsubsteps</at> attribute clamps the number of steps allowed between updates. The default frequency of 60 and <at>maxsubsteps</at> of 1 requires a FPS of 60. If the FPS is 30, <at>maxsubsteps</at> should be increased (allowing for more than 1 simulation step each update). If the simulation is behaving incorrectly (rigid body penetration, erratic movement, etc), try increasing the simulation frequency and sub-steps.
	</discussion>
</c74object>
