<_templates Include="trucks">
	<Body>
		<Grappler
			Collisions="Internal"
			ForceBodyParams="true"
			Friction="2.0"
			Mass="200"
			NoClientCollisions="true"
		>
			<Constraint AxisLocal="(0;0;-1)" Type="Hinge">
				<Motor
					Damping="1.0"
					Force="30000"
					Tau="0.04"
					Type="Position"
				/>
			</Constraint>
		</Grappler>
	</Body>
</_templates>
<TruckAddon>
	<PoweredConstraints>
		<Group Id="crane_grab" IsGamepadHotkey="true">
			<Constraint Name="RightGrappler" Position="90" />
			<Constraint Name="LeftGrappler" Position="90" />
		</Group>
	</PoweredConstraints>
	<PhysicsModel Mesh="trucks/k8400_skidder_crane">
		<Body
			CenterOfMassOffset="(0; 0.2; 0)"
			ImpactType="Truck"
			Mass="600"
		>
			<Constraint Type="Fixed" />
			<Body Mass="400" ModelFrame="BoneArm1_cdt">
				<Constraint
					AxisLocal="(0;0;-1)"
					MinLimit="-60"
					MaxLimit="0"
					Name="Arm1"
					Type="Hinge"
				>
					<Motor Force="200000" Tau="0.2" Type="Position" />
				</Constraint>
				<Body Mass="300" ModelFrame="BoneArm2_cdt">
					<Constraint Type="Fixed" />
					<Body Collisions="None" Mass="40" ModelFrame="BoneGrapplerRoot_cdt">
						<Constraint
							AxisLocal="(0;1;0)"
							MinLimit="-180"
							MaxLimit="180"
							Name="GrapplerRoot"
							Type="Hinge"
						>
							<Motor
								Damping="1.0"
								Force="60000"
								Tau="0.2"
								Type="Position"
							/>
						</Constraint>
						<Body Collisions="None" Mass="100" ModelFrame="BoneGrapplerBase_cdt">
							<Constraint
								AxisLocal="(1;0;0)"
								MinLimit="-40"
								MaxLimit="110"
								Type="Hinge"
							>
								<Motor Damping="200" Spring="100" Type="Spring" />
							</Constraint>
							<Body
								Collisions="Internal"
								ForceBodyParams="true"
								Mass="100"
								ModelFrame="BoneGrappler_cdt"
								AngularDamping="2"
							>
								<Constraint
									AxisLocal="(0;0;1)"
									MinLimit="-45"
									MaxLimit="45"
									Type="Hinge"
								>
									<Motor Damping="200" Spring="100" Type="Spring" />
								</Constraint>
								<Body _template="Grappler" ModelFrame="BoneGrapplerLeft_cdt">
									<Constraint MinLimit="0" MaxLimit="90" Name="LeftGrappler" />
								</Body>
								<Body _template="Grappler" ModelFrame="BoneGrapplerRight_cdt">
									<Constraint MinLimit="0" MaxLimit="90" Name="RightGrappler" />
								</Body>
							</Body>
						</Body>
					</Body>
				</Body>
			</Body>
		</Body>
	</PhysicsModel>
	<GameData BalancePoints="4" LogPoints="2">
		<InstallSocket Type="Cat545cSkidderCrane" />
	</GameData>
	<ControlledConstraints>
		<Constraint ActionId="crane" Id="crane" Name="Arm1" />
		<Constraint
			Id="crane_grappler"
			Name="GrapplerRoot"
			LinkToControlledConstraint="crane"
			SetFreeWhenNotControlled="true"
		/>
	</ControlledConstraints>
	<AutomaticIK>
		<IKBone ModelFrame="BoneeArm1PistonBase" ParentFrame="BoneTail_cdt">
			<IKJoint AxisLocal="(0;0;1)" Type="Hinge" />
			<IKBone
				AttachOffset="(0; 0; 0)"
				AttachToFrame="BoneArm1_cdt"
				ModelFrame="BoneeArm1Piston"
			>
				<IKJoint AxisLocal="(0;1;0)" Type="Slider" />
			</IKBone>
		</IKBone>
		<IKBone ModelFrame="BoneeArm2PistonBase" ParentFrame="BoneTail_cdt">
			<IKJoint AxisLocal="(0;0;1)" Type="Hinge" />
			<IKBone
				AttachOffset="(0; 0; 0)"
				AttachToFrame="BoneArm2_cdt"
				ModelFrame="BoneeArm2Piston"
			>
				<IKJoint AxisLocal="(0;1;0)" Type="Slider" />
			</IKBone>
		</IKBone>
	</AutomaticIK>
	<AddonCamera FirstPersonDir="(-4; 0.5; -1.0)" FirstPersonPos="(-2.6; 2.5; 2.8)" />
</TruckAddon>
