On this page
Module guide

Winch Recovery

Use the Recovery Truck 6x6 winch to pull a 2,400 kg sled across the recovery line.

The example vehicle includes a seated driver. RCCP 2 core supplies the driver model and controller.

Install the module

If you imported the complete Driving Sandbox, this module is already installed. Go to the next section. Use these steps only for RCCP2-WinchRecovery.unitypackage, made with Export Module > Winch Recovery.

Installation order for Winch Recovery
  1. If any required packages are missing, install Input System, Editor Coroutines and Unity UI in Package Manager.
  2. Install Realistic Car Controller Pro 2 v4.1.3 or later. The RCCP 2 installer stops if a required package is missing.
  3. Open Edit > Project Settings > Player > Other Settings.
  4. Set Active Input Handling to Input System Package (New) or Both.
  5. If Unity requests a restart, restart the Editor.
  6. If TMP Essential Resources are missing, select Window > TextMeshPro > Import TMP Essential Resources. The winch button labels use TextMesh Pro.
  7. Use Assets > Import Package > Custom Package to import RCCP2-WinchRecovery.unitypackage.

The module includes its own truck prefab, winch equipment scripts, training sled and HUD.

Drive the example

Winch Recovery at the start of Play Mode
No. Item
1 Instruction
2 Sled travel, cable length and tension
3 RETRY button
4 Winch buttons
5 INFO button
6 Recovery line
7 Training Sled
8 Recovery Truck 6x6
  1. Open Assets/RCCP 2 Driving Sandbox/Modules/WinchRecovery/Samples/Winch Recovery Example.unity.
  2. Enter Play Mode. The handbrake starts engaged. Press W to release the handbrake and drive.
  3. Find the winch buttons at the bottom right: PAY OUT, REEL IN, ATTACH and DETACH.
  4. Hold PAY OUT until the HUD shows Hook in reach. Select ATTACH.
  5. Select ATTACH. If the HUD shows ATTACH found no load in reach, hold PAY OUT longer and try again.
  6. Hold REEL IN until the sled crosses the marked recovery line. The HUD then shows Load recovered.
  7. Select DETACH.
  8. Select RETRY to restore the starting poses, rewind the cable and apply the handbrake again.
One recovery, from pay out to the result

Select INFO in the sample to see the keys and setup steps.

The truck and sled use normal Rigidbody physics with no frozen axes. The cable pulls both bodies toward each other with up to 70 kN. The truck can move if cable tension exceeds the available tire grip.

The example keeps the handbrake engaged until you press the throttle. Releasing the throttle does not apply the handbrake again. Use Space to brake manually after driving, or select RETRY to park at the start.

The Info panel

Task result feedback

Winch Recovery result banner

The HUD shows a green banner when the sled crosses the recovery line. If ATTACH finds no load in reach, the HUD shows an amber warning. Move the hook into reach to continue the recovery. The HUD keeps the recovery result until you select RETRY.

The banner stays fully visible for 3 seconds between fades. A new attempt hides the banner sooner. Play continues during the banner. You can use the HUD buttons while the banner is visible.

The supplied HUD has a Result Notification reference. Clear Result Notification to hide the banner and keep the standard HUD. Keep the included Shared/UI/SandboxTaskNotification.cs script in the project when you use the HUD.

Controls

Action Key
Drive and steer W / A / S / D
Hold the handbrake Space
Pay out cable 7 or Insert, or hold PAY OUT
Reel in cable 8 or Delete, or hold REEL IN
Attach the hook 9 or \, or select ATTACH
Detach the hook 0 or ;, or select DETACH
Raise / lower the boom Y / H or Home / End
Raise / lower the rear lift U / J or Page Up / Page Down
Start again RETRY button

Hold Select on a gamepad to use the equipment controls. Move the right stick up or down for the boom. Move the stick left or right for the rear lift. Hold Select and Start together to use the right stick for the cable. Move the stick up to pay out or down to reel in.

With Select released, tap Start to attach the hook. To detach, hold Start for at least 0.5 seconds, then release it.

You can complete the recovery without the boom and the rear lift. During an RCCP replay, RETRY and the winch controls do nothing. An attached load stays hooked.

Winch Recovery keys

Use it in your scene

If you use the complete Driving Sandbox, open your scene. If the scene has a vehicle with Winch Recovery Equipment, select that vehicle. On the Winch Recovery card, select Add to Scene.

If the scene has no eligible vehicle, the tool adds the supplied Recovery Truck 6x6. Keep a clear, level floor between the truck and the sled. Point a camera at the recovery area. Complete any other steps in the setup dialog.

Relative asset paths start at Assets/RCCP 2 Driving Sandbox/Modules/WinchRecovery/.

In a single module package, or to do it manually, use these steps.

Before you start, prepare a level floor with a solid collider. To use an RCCP Camera, select Tools > BoneCracker Games > Realistic Car Controller Pro 2 > Add to Scene > RCCP Camera. Then disable the original Main Camera.

Use the supplied Recovery Truck 6x6. Winch Recovery Equipment needs the truck rig and its part references. See Truck and winch rules.

  1. Drag Prefabs/Recovery Truck 6x6.prefab into the scene.
  2. If the scene has no RCCP Scene Manager, select Tools > BoneCracker Games > Realistic Car Controller Pro 2 > Add to Scene > Scene Manager.
  3. On RCCP Scene Manager, drag the truck from the Hierarchy to Active Player Vehicle. Clear Register Last Vehicle As Player. The winch keys and buttons work only for the active player vehicle.
  4. Drag Prefabs/Training Sled.prefab into the scene.
  5. Place the sled straight behind the truck, on the truck's center line. Leave a gap of a few meters.
  6. Keep the truck Rigidbody Constraints set to None.
  7. Create an empty GameObject between the sled and the truck. Name it Recovery Line.
  8. Turn Recovery Line so that its blue (Z) axis points toward the truck.
  9. Create another empty GameObject. Name it Winch Recovery Challenge.
  10. Select Add Component > BoneCracker Games > Driving Sandbox > Winch Recovery > Winch Recovery Challenge.
  11. Drag the truck from the Hierarchy to Equipment.
  12. Drag the sled from the Hierarchy to Load.
  13. Drag Recovery Line to Recovery Line.
  14. Connect On Recovered to your result.
  15. Drag Prefabs/Winch Recovery HUD.prefab into the scene. It has its own Canvas and its own winch buttons.
  16. Drag the challenge from the Hierarchy to Challenge on the HUD.
  17. If the scene has no EventSystem, select GameObject > UI > Event System. Use an Input System UI Input Module on the EventSystem.
The sled, the recovery line and the truck from above
Winch Recovery Challenge: 1 Equipment, 2 Load, 3 Recovery Line, 4 Park Until Throttle. Winch Recovery HUD: 1 Challenge
The recovery line between the sled and the truck

Select Winch Recovery Challenge to see the recovery line in the Scene view. The gizmo arrow shows the required direction toward the truck.

The example hierarchy

Do not add a second set of winch buttons. The stock RCCP Canvas (Assets/Realistic Car Controller Pro 2/Prefabs/UI/RCCP_Canvas.prefab) also has winch buttons at the bottom right. If you add that canvas, disable Winch Recovery HUD/Winch Controls.

Enable Park Until Throttle on the challenge to use the example's automatic starting handbrake. This setting is off by default. Without this setting, hold Space while you reel in. The truck remains subject to gravity, collisions and cable tension.

If you spawn the truck or the sled at runtime, call Configure(equipment, load) on the challenge after they are in place. Call RCCP.RegisterPlayerVehicle for a spawned truck.

Truck and winch rules

  • The rear probe is the WinchCableExit object at the rear of the truck. The Cable Start field on Winch Recovery Equipment points to it.
  • ATTACH sends a ray straight back from the rear probe. The ray must hit the load collider. The hit point must be within the paid-out cable length of the boom tip.
  • Pay out at least 0.75 m of cable before you attach. The cable holds up to 18 m.
  • The winch pulls with up to 70 kN. The load must have a Rigidbody that is not kinematic.
  • Winch Recovery Equipment moves the boom, rear lift, drum and hydraulic parts of the truck model. It needs the Boom, Underlift, Drum, Barrel, Rod, Base Pin and Boom Pin Transforms of that model.
  • Other vehicles do not have these parts. If a part reference is missing, the component disables itself and logs a warning. Use the supplied truck.
  • Put only one winch component on a vehicle. If the vehicle has a second winch, for example the RCCP Demo Content recovery equipment, this component disables itself and logs a warning.
Winch Recovery Equipment: 1 Cable Start. RCCP Scene Manager: 1 Active Player Vehicle

Script reference

Add using BoneCrackerGames; and using BoneCrackerGames.DrivingSandbox.WinchRecovery; to your script.

Member Purpose
WinchRecoveryChallenge.Configure(equipment, load) Assigns a truck and a load at runtime. Their current poses become the Retry poses, and a new attempt starts.
WinchRecoveryChallenge.Retry() Rewinds the cable and restores the start poses of the truck and the load. During an RCCP replay, the method does nothing.
WinchRecoveryChallenge.IsReady True when the last setup check of Equipment, Load and Recovery Line passed.
WinchRecoveryChallenge.IsHooked, IsComplete True when the load is on the hook, and true after the hooked load crosses the line.
WinchRecoveryChallenge.LoadTravelMeters, GoalMeters Load travel toward the line, and the distance from the load start to the line.
WinchRecoveryChallenge.CableMeters, CableTension, PeakTension Paid-out cable, current tension and peak tension of the attempt (newtons).
WinchRecoveryChallenge.Equipment, Load The assigned equipment and load.
WinchRecoveryChallenge.OnRecovered Invoked once for each attempt when the hooked load crosses the line.
WinchRecoveryEquipment.TryAttachWinchLoad(), DetachLoad() Attaches the load behind the truck, or releases it.
WinchRecoveryEquipment.TryAttachLoad(load, worldPoint) Attaches a separate, non-kinematic Rigidbody at a world point. The point must be at least 0.75 m from the cable outlet and within the paid-out length.
WinchRecoveryEquipment.WinchLength, WinchTension, AttachedLoad Paid-out cable in meters, cable tension in newtons, and the attached Rigidbody.
WinchRecoveryEquipment.IsLoadInReach True when no load is attached and ATTACH would connect a load now.
WinchRecoveryEquipment.LastAttachFailTime Unscaled time of the last attach request that found no load in reach. A successful attach or Retry sets it to -1.
WinchRecoveryEquipment.IsReady True when the equipment started correctly and all its part references are assigned.
WinchRecoveryEquipment.CableStart, CableOutlet The rear probe, and the point where the cable leaves the truck.
WinchRecoveryEquipment.boom, underlift, drum, barrel, rod, basePin, boomPin The part Transforms of the truck model. All seven are required.
IRCCP_Winch.HasWinchLoad, SetWinchSpool(value), DetachWinchLoad() Control the winch from your own HUD. A positive value pays out. A negative value reels in.
WinchRecoveryEquipment.payOutSpeed, reelInSpeed Cable speeds at full input, in meters per second.
WinchRecoveryHud.Retry() Calls Retry() on the assigned challenge.

Troubleshooting

Symptom Cause Fix
The Console says it cannot find IRCCP_Winch. RCCP 2 is older than v4.1. Update RCCP 2 to v4.1.3 or later in Package Manager > My Assets.
The HUD shows ASSIGN THE CHALLENGE ON THIS HUD. Challenge on the HUD is empty. Drag the Winch Recovery Challenge from the Hierarchy to Challenge.
The HUD shows SET UP THE CHALLENGE - SEE THE CONSOLE. Equipment, Load or Recovery Line is empty or wrong, the load is kinematic, or the line faces the wrong way. Read the Console warning. It names the field to fix.
The HUD shows ATTACH found no load in reach. The cable is too short, or the ray from the rear probe misses the load. Hold PAY OUT longer. Move the load straight behind the truck.
No winch buttons appear, and the winch keys do nothing. The truck is not the Active Player Vehicle, or Register Last Vehicle As Player is on. The winch equipment can also disable itself. Assign the truck to Active Player Vehicle. Clear Register Last Vehicle As Player. Read any warning from Winch Recovery Equipment.
The HUD buttons show but do not respond to clicks. The EventSystem or its Input System UI Input Module is missing. Add the missing object or component. Read any HUD warning in the Console.
Two sets of winch buttons appear. The scene has the stock RCCP Canvas and the HUD. Disable Winch Recovery HUD/Winch Controls.
The truck moves toward the load when you reel in. Cable tension acts on both bodies. Hold Space while you reel in. Check the tire grip and the ground slope.