<?xml version="1.0"?>
<_templates Include="trucks">
	<Constraint>
		<Crane Name="Crane" />
				<AnchorBase Type="Hinge" Axis="(1;0;0)">
			<Motor Type="Position" Force="16000" />
		</AnchorBase>
		<AnchorExt
			Name="AnchorExt"
			Type="Prismatic"
			MinLimit="0"
			MaxLimit="0.5"
		>
			<Motor Type="Position" Force="16000" />
		</AnchorExt>
		<Anchor
			Name="Anchor"
			Type="Prismatic"
			Axis="(0;1;0)"
			MinLimit="0"
			MaxLimit="0.8"
		>
			<Motor Type="Position" Force="16000" />
		</Anchor>
		<Grappler Type="Hinge" Axis="(0;0;1)">
			<Motor
				Type="Position"
				Force="22000"
				Tau="0.4"
				Damping="1.0"
			/>
		</Grappler>
	</Constraint>
</_templates>


<TruckAddon IsChassisFullOcclusion="true">
	<GameData RepairsCapacity="100">
		<RequiredAddon Type="F Crane Support" />
		<InstallSocket Type="KrazCrane"  Offset="(0.13; -0.08; 0.0)"  />
		<InstallSocket Type="Maz2Tractor" Offset="(0.6; -0.35; 0.0)"/>
		<InstallSocket Type="ZilTractor" Offset="(0.6; 0.0; 0.0)" />
		<WinchSocket ParentFrame="BoneGrappler_cdt"

Offset="(1.75; 2.80; 0)" />
		<LoadArea
			Type="MediumLogs"
			Min="(-2.276; 1.42; -1.12)"
			Max="(-0.623; 2.09; 1.12)"
		/>
	</GameData>
	<PhysicsModel Mesh="ural_cart.xml">
		<Body Mass="1400" ImpactType="Truck">
			<Constraint Type="Fixed" />
			<Body ModelFrame="BoneFork_cdt" _template="CartForkBase">
				<Body
					ModelFrame="BoneTopChain_cdt"
					Mass="10"
					AngularDamping="1"
					Collisions="None"
				>
					<Constraint
						Type="Prismatic"
						Axis="(0;1;0)"
						MinLimit="-1"
						MaxLimit="0"
					>
						<Motor
							Type="Spring"
							Spring="120"
							Damping="20"
						/>
					</Constraint>
				</Body>
				<Body ModelFrame="BoneLeftFork_cdt" _template="CartFork">
					<Constraint Axis="(-1;0;0)" />
					<Body
						ModelFrame="BoneLeftChain_cdt"
						Mass="10"
						AngularDamping="1"
						Collisions="None"
					>
						<Constraint
							Type="Ragdoll"
							PlaneMin="0"
							PlaneAxis="(0;1;0)"
						/>
					</Body>
				</Body>
				<Body ModelFrame="BoneRightFork_cdt" _template="CartFork">
					<Body
						ModelFrame="BoneRightChain_cdt"
						Mass="10"
						AngularDamping="1"
						Collisions="None"
					>
						<Constraint
							Type="Ragdoll"
							PlaneMax="0"
							PlaneAxis="(0;1;0)"
						/>
					</Body>
				</Body>
			</Body>
			<Body ModelFrame="BoneRotationBase_cdt" Mass="200">
				<Constraint
					_template="Crane"
					Type="Hinge"
					Axis="(0;1;0)"
					MinLimit="-360"
					MaxLimit="360"
				>
					<Motor Type="Position" Force="62000" />
				</Constraint>
				<Body
					ModelFrame="BoneArm1_cdt"
					Mass="200"
					Collisions="Internal"
				>
					<Constraint
						_template="Crane"
						Type="Hinge"
						Axis="(1;0;0)"
						MinLimit="-70"
						MaxLimit="30"
					>
						<Motor Type="Position" Force="200000" />
					</Constraint>
					<Body
						ModelFrame="BoneArm2_cdt"
						Mass="200"
						Collisions="Internal"
					>
						<Constraint
							_template="Crane"
							Type="Hinge"
							Axis="(1;0;0)"
							MinLimit="-160"
							MaxLimit="0"
						>
							<Motor Type="Position" Force="90000" />
						</Constraint>
						<Body
							ModelFrame="BoneArm3_cdt"
							Mass="100"
							Collisions="Internal"
						>
							<Constraint
								_template="Crane"
								Type="Prismatic"
								Axis="(0;1;0)"
								MinLimit="0"
								MaxLimit="1"
							>
								<Motor Type="Position" Force="25000" />
							</Constraint>
							<Body
								ModelFrame="BoneGrapplerBase_cdt"
								Mass="50"
								Collisions="Internal"
							>
								<Constraint
									Type="Hinge"
									Axis="(1;0;0)"
									MinLimit="-30"
									MaxLimit="150"
								>
									<Motor
										Type="Spring"
										Spring="0"
										Damping="40"
									/>
								</Constraint>
								<Body
									ModelFrame="BoneGrappler_cdt"
									Mass="50"
									Collisions="Internal"
								>
									<Constraint
										Name="GrapplerBase"
										Type="Hinge"
										Axis="(0;1;0)"
										MinLimit="-180"
										MaxLimit="180"
									>
										<Motor
											Type="Position"
											Force="12000"
											Tau="0.1"
										/>
									</Constraint>
									<Body
										ModelFrame="BoneGrapplerLeft_cdt"
										Mass="100"
										Collisions="Internal"
										Friction="4"
										NoStatCollisions="true"
									>
										<Constraint
											_template="Grappler"
											Name="LeftGrappler"
											MinLimit="-160"
											MaxLimit="0"
										/>
									</Body>
									<Body
										ModelFrame="BoneGrapplerRight_cdt"
										Mass="100"
										Collisions="Internal"
										Friction="4"
										NoStatCollisions="true"
									>
										<Constraint
											_template="Grappler"
											Name="RightGrappler"
											MinLimit="0"
											MaxLimit="160"
										/>
									</Body>
								</Body>
							</Body>
						</Body>
					</Body>
				</Body>
			</Body>
			<Body
				ModelFrame="BoneRightAnchorExt_cdt"
				Mass="160"
				Collisions="None"
			>
				<Constraint
					_template="AnchorExt"
					MinLimit="0"
					MaxLimit="0.6"
					Axis="(0;1;0)"
				/>
				<Body
					ModelFrame="BoneRightAnchorBase_cdt"
					Mass="50"
					NoFoliageCollisions="true"
				>
					<Constraint
						_template="AnchorBase"
						Name="RightAnchorBase"
						MinLimit="-180"
						MaxLimit="0"
					/>
					<Body
						ModelFrame="BoneRightAnchor_cdt"
						Mass="20"
						NoFoliageCollisions="true"
					>
						<Constraint
							_template="Anchor"
							MinLimit="0"
							MaxLimit="0.8"
						/>
					</Body>
				</Body>
			</Body>
			<Body
				ModelFrame="BoneLeftAnchorExt_cdt"
				Mass="160"
				Collisions="None"
			>
				<Constraint
					_template="AnchorExt"
					MinLimit="0"
					MaxLimit="0.6"
					Axis="(0;1;0)"
				/>
				<Body
					ModelFrame="BoneLeftAnchorBase_cdt"
					Mass="50"
					NoFoliageCollisions="true"
				>
					<Constraint
						_template="AnchorBase"
						Name="LeftAnchorBase"
						MinLimit="0"
						MaxLimit="180"
					/>
					<Body
						ModelFrame="BoneLeftAnchor_cdt"
						Mass="20"
						NoFoliageCollisions="true"
					>
						<Constraint _template="Anchor" />
					</Body>
				</Body>
			</Body>
		</Body>
	</PhysicsModel>
	<HeadLight
		_template="Default"
		ParentFrame="BoneArm1_cdt"
		Offset="(1.997; 3.376; 0.0)"
		Direction="(1.0; -0.6; 0)"
		AttenEnd="32"
	/>
	<ModelAttachments>
		<HeadLight>
			<Flare
				_template="HeadLight"
				ParentFrame="BoneArm1_cdt"
				Offset="(1.997; 3.376; -0.24)"
			/>
			<Flare
				_template="HeadLight"
				ParentFrame="BoneArm1_cdt"
				Offset="(1.997; 3.376; 0.24)"
			/>
			<Flare
				_template="BlueStreak"
				ParentFrame="BoneArm1_cdt"
				Offset="(1.997; 3.376; -0.24)"
			/>
			<Flare
				_template="BlueStreak"
				ParentFrame="BoneArm1_cdt"
				Offset="(1.997; 3.376; 0.24)"
			/>
			<Model
				_template="HeadLightRay"
				ParentFrame="BoneArm1_cdt"
				Org="(1.997; 3.376; -0.24)"
			/>
			<Model
				_template="HeadLightRay"
				ParentFrame="BoneArm1_cdt"
				Org="(1.997; 3.376; 0.24)"
			/>
		</HeadLight>
	</ModelAttachments>
	<PoweredConstraints>
		<crane_grap>
			<Constraint
				Name="RightGrappler"
				Position="120"
				InitialFix="true"
			/>
			<Constraint
				Name="LeftGrappler"
				Position="-120"
				InitialFix="true"
			/>
		</crane_grap>
		<anchors_extend>
			<Constraint
				Name="AnchorExt"
				Position="0.5"
				InitialFix="true"
				TerminalFix="true"
			/>
			<Constraint
				Name="AnchorExt"
				Position="0.5"
				InitialFix="true"
				TerminalFix="true"
			/>
		</anchors_extend>
		<anchors_position>
			<Constraint Name="RightAnchorBase" Position="-180" />
			<Constraint Name="LeftAnchorBase" Position="180" />
		</anchors_position>
		<anchors_push>
			<Constraint
				Name="Anchor"
				Position="0.8"
				TerminalFix="true"
			/>
		</anchors_push>
	</PoweredConstraints>
	<ControlledIK>
		<crane
			ModelFrames="BoneCart_cdt,BoneRotationBase_cdt,BoneArm1_cdt,BoneArm2_cdt,BoneArm3_cdt"
			AffectedFrames="BoneRotationBase_cdt,BoneArm1_cdt,BoneArm2_cdt,BoneArm3_cdt,BoneGrapplerBase_cdt,BoneGrappler_cdt,BoneGrapplerRight_cdt,BoneGrapplerLeft_cdt"
			CenterXZ="(1.0; 0)"
			EndOffset="(0; 2.168; 0)"
		/>
	</ControlledIK>
	<ControlledConstrains>
		<crane_grappler Name="GrapplerBase" LinkedControlledIK="crane" />
	</ControlledConstrains>
	<AutomaticIK>
		<IKBone ModelFrame="BoneConnector1" ParentFrame="BoneArm1_cdt">
			<IKJoint Type="Hinge" Axis="(1;0;0)" />
			<IKBone
				ModelFrame="BoneConnector2"
				AttachToFrame="BoneArm2_cdt"
				AttachOffset="(0; 0.65; 0)"
			>
				<IKJoint Type="Hinge" Axis="(1;0;0)" />
			</IKBone>
		</IKBone>
		<IKBone ModelFrame="BoneArmPistonBase" ParentFrame="BoneArm1_cdt">
			<IKJoint Type="Hinge" Axis="(1;0;0)" />
			<IKBone
				ModelFrame="BoneArmPiston"
				AttachToFrame="BoneConnector1"
				AttachOffset="(0; 1.333; 0)"
			>
				<IKJoint Type="Slider" Axis="(0;1;0)" />
			</IKBone>
		</IKBone>
		<IKBone ModelFrame="BoneBasePistonBase" ParentFrame="BoneArm1_cdt">
			<IKJoint Type="Hinge" Axis="(1;0;0)" />
			<IKBone
				ModelFrame="BoneBasePixton"
				AttachToFrame="BoneRotationBase_cdt"
				AttachOffset="(0; 0.713; 0)"
			>
				<IKJoint Type="Slider" Axis="(0;1;0)" />
			</IKBone>
		</IKBone>
		<IKBone ModelFrame="BoneGrapplerPistonBaseTop" ParentFrame="BoneGrapplerLeft_cdt">
			<IKJoint Type="Hinge" Axis="(0;0;1)" />
			<IKBone
				ModelFrame="BoneGrapplerPistonTop"
				AttachToFrame="BoneGrapplerRight_cdt"
				AttachOffset="(0; 0.296; 0)"
			>
				<IKJoint Type="Slider" Axis="(0;1;0)" />
			</IKBone>
		</IKBone>
		<IKBone ModelFrame="BoneGrapplerPistonBaseBottom" ParentFrame="BoneGrapplerRight_cdt">
			<IKJoint Type="Hinge" Axis="(0;0;1)" />
			<IKBone
				ModelFrame="BoneGrapplerPistonBottom"
				AttachToFrame="BoneGrapplerLeft_cdt"
				AttachOffset="(0; 0.316; 0)"
			>
				<IKJoint Type="Slider" Axis="(0;1;0)" />
			</IKBone>
		</IKBone>
	</AutomaticIK>
</TruckAddon>
