Trailer Delivery
Hitch the assigned trailer and park its footprint inside the delivery bay.
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-TrailerDelivery.unitypackage, made with Export Module > Trailer Delivery.
- If any required packages are missing, install Input System, Editor Coroutines and Unity UI in Package Manager.
- Install Realistic Car Controller Pro 2 v4.1.3 or later. The RCCP 2 installer stops if a required package is missing.
- Open Edit > Project Settings > Player > Other Settings.
- Set Active Input Handling to Input System Package (New) or Both.
- If Unity requests a restart, restart the Editor.
- If TMP Essential Resources are missing, select Window > TextMeshPro > Import TMP Essential Resources.
- Use Assets > Import Package > Custom Package to import
RCCP2-TrailerDelivery.unitypackage.
Drive the example
| No. | Item |
|---|---|
| 1 | RCCP dashboard: speed, gear and engine RPM |
| 2 | Next instruction |
| 3 | RETRY button |
| 4 | INFO button |
| 5 | Pilot Trailer |
| 6 | Tow vehicle |
- Open
Assets/RCCP 2 Driving Sandbox/Modules/TrailerDelivery/Samples/Trailer Delivery Example.unity. - Enter Play Mode.
- Hold S to reverse straight until the hitch connects automatically.
- Reverse until the trailer footprint is fully inside BAY 03. The yellow bay is directly behind the start position.
- Steer with A and D to point the trailer front along the yellow arrows.
- Stop the tow vehicle and trailer. Use Space to help hold the position.
- Wait until the HUD shows DELIVERY COMPLETE.
- Select RETRY to start another delivery. In the example, RETRY detaches the trailer and returns both vehicles to their start poses.
Select INFO in the sample to see the controls, rules and setup steps.
If the trailer jackknifes or jams against a wall:
- Drive forward with W to straighten the trailer behind the tow vehicle.
- Reverse into the bay again.
- If the rig stays stuck, select RETRY. The tow vehicle and the trailer go back to their start poses.
Task result feedback
The HUD shows a green banner when the delivery is complete. The HUD keeps DELIVERY COMPLETE visible 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 |
|---|---|
| Throttle | W or Up Arrow |
| Brake and reverse | S or Down Arrow |
| Steer | A / D or Left / Right Arrow |
| Handbrake | Space |
| Detach trailer | T |
| Change camera | C |
Use it in your scene
If you use the complete Driving Sandbox, open your scene. Select your RCCP vehicle in the Hierarchy. On the Trailer Delivery card, select Add to Scene.
Move Parking Bay to the delivery location. Turn Target Pose to the required trailer heading. If the tool adds a hitch, check its position at the rear bumper. Complete any other steps in the setup dialog.
Relative asset paths start at Assets/RCCP 2 Driving Sandbox/Modules/TrailerDelivery/.
In a single module package, or to do it manually, use these steps.
Before you start, prepare a scene with a solid driving surface. To test, drag Samples/Tow Sedan.prefab into the scene. Place the vehicle at its normal spawn height above the surface.
To add a driving camera, select Tools > BoneCracker Games > Realistic Car Controller Pro 2 > Add to Scene > RCCP Camera. Then disable the original Main Camera. For the dashboard, select Tools > BoneCracker Games > Realistic Car Controller Pro 2 > Add to Scene > UI Canvas.
If the scene has no RCCP Scene Manager, select Tools > BoneCracker Games > Realistic Car Controller Pro 2 > Add to Scene > Scene Manager. If the scene has more than one vehicle, assign your vehicle to Active Player Vehicle on RCCP Scene Manager. Clear Register Last Vehicle As Player. If this option is on, the last eligible vehicle can take the player slot at startup.
- Add
Prefabs/Trailer Delivery.prefabto the scene. - If the tow vehicle has no trailer hitch, add Trailer from Features in its RCCP Car Controller Inspector. The module creates
RCCP_TrailerAttacherunderRCCP_OtherAddons. The suppliedSamples/Tow Sedan.prefabalready has a hitch named Rear Hitch. - Check that the hitch is at the rear bumper. Move the hitch to the rear bumper if necessary. Make sure that it has a trigger Box Collider.
- Drag the tow vehicle from the Hierarchy to Tow Vehicle on the challenge.
- Drag
Prefabs/Pilot Trailer.prefabinto the scene behind the tow vehicle. You can also use your own RCCP trailer. Its front hitch needs a trigger Box Collider and an RCCP Trailer Attacher. - Drag the trailer from the Hierarchy to Trailer.
- Assign the trailer body's Box Collider to Trailer Bounds. On Pilot Trailer, use the Box Collider on the root object.
- Move the Parking Bay child object to the delivery location. Set the Size of its trigger Box Collider to contain the trailer footprint.
- Rotate the Target Pose child object until its blue Z axis points in the direction the trailer front must face.
- Select the challenge to check the setup in the Scene view. The yellow box is the bay. The cyan arrow is the required heading.
- If you use the supplied HUD, select RETRY to start a delivery. Without the HUD, enable Start On Play or call
StartDelivery(). - For the HUD, add
Prefabs/Delivery HUD.prefab. Assign the challenge to Challenge on the HUD. - If the scene has no EventSystem, select GameObject > UI > Event System. Use an Input System UI Input Module on the EventSystem.
- To reset both vehicles on RETRY, put the tow vehicle and trailer at their start poses. Create an empty GameObject at each root position and rotation. Keep both objects at their vehicle root heights. Assign Tow Retry Spawn and Trailer Retry Spawn on the HUD. RETRY detaches the trailer and moves both vehicles. To retry without moving the vehicles, leave both fields empty.
The challenge reads only the size, center and transform of Trailer Bounds. Do not add a solid collider that reaches the wheels, because it drags on the ground. If the trailer has no suitable body collider, add a Box Collider to a child object. Disable the new collider.
If you spawn the tow vehicle or the trailer at runtime, set TowVehicle, Trailer and TrailerBounds in your code. Each assignment returns the delivery to idle. Then call StartDelivery().
The example scene, Samples/Tow Sedan.prefab and the yard art in Samples are sample-only. The reusable prefabs use files in Prefabs, Materials and Runtime, RCCP 2 core and Shared/UI/SandboxTaskNotification.cs.
Parking rules
The challenge arms parking when the assigned trailer is hitched and at least one corner of its footprint is outside the bay. To complete the delivery, keep the trailer hitched and its full footprint inside the bay. Keep the heading and both planar speeds within their limits for the full hold duration. Replay time does not count toward the hold.
The example permits a heading error of up to 10° and a planar speed of up to 1 km/h for each vehicle. The example requires all parking conditions to stay valid for 1 second. Change Maximum Angle, Maximum Speed Kph and Hold Duration on the challenge to set different limits.
The challenge detects the hitch through the tow vehicle's RCCP_TrailerAttacher under RCCP_OtherAddons. An attacher in another location can connect the trailer, but the challenge cannot detect the connection.
Script reference
Add using BoneCrackerGames; and using BoneCrackerGames.DrivingSandbox.TrailerDelivery; to your script.
| Member | Purpose |
|---|---|
StartDelivery() |
Checks the setup and starts a delivery. Logs one warning for each setup problem and stays idle if the setup is not valid. |
ResetDelivery() |
Clears the progress and returns the delivery to idle. |
TowVehicle |
Gets or sets the tow vehicle. Setting it returns the delivery to idle. |
Trailer |
Gets or sets the trailer. Setting it returns the delivery to idle. |
TrailerBounds |
Gets or sets the Box Collider that gives the trailer footprint. Setting it returns the delivery to idle. |
Bay |
The parking bay trigger box. |
State |
Idle, WaitingForHitch, Driving, Parking or Delivered. |
Instruction |
The next step for the driver: Ready, Hitch, ExitBay, EnterBay, Align, Stop, Hold or Complete. Use it to build your own HUD text. |
HeldSeconds |
Seconds that the parking conditions have stayed valid. |
HoldDuration |
Seconds that the parking conditions must stay valid. |
FootprintInside |
Result of the last parking check. True when the trailer is hitched and all four bottom corners of Trailer Bounds are inside the bay. |
HeadingError |
Last angle in degrees between the trailer front and Target Pose, measured on the bay plane. |
OnDelivered |
Called once when a delivery succeeds. |
DeliveryHUD.Retry() |
Calls StartDelivery() on the assigned challenge. If Tow Retry Spawn and Trailer Retry Spawn are assigned, it first detaches the trailer and moves both vehicles to these poses at rest. During a replay it does not move the vehicles. |
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
| Another vehicle responds to the keys. | Register Last Vehicle As Player is on, or Active Player Vehicle points to another vehicle. | Assign your vehicle to Active Player Vehicle. Clear Register Last Vehicle As Player. |
| The HUD shows Ready for delivery and does not change. | Start On Play is off, or StartDelivery() found a setup problem. |
Enable Start On Play, or select RETRY. If the Console shows a warning, correct the field that the warning names. |
The Console says that Tow Vehicle has no Trailer module under RCCP_OtherAddons. |
The tow vehicle has no RCCP_TrailerAttacher, or the attacher is in another location. |
Remove the other attacher. Add the Trailer module in the RCCP Car Controller Inspector. |
| The HUD shows ASSIGN THE CHALLENGE ON THIS HUD. | Challenge on the HUD is empty. | Drag the Trailer Delivery from the Hierarchy to Challenge on the HUD. |
| RETRY does not respond to clicks. | The EventSystem or its Input System UI Input Module is missing. | Add the missing object or component. |
| The trailer is in the bay, but the HUD asks you to reverse until it is fully inside. | Trailer Bounds is larger than the bay, or its bottom is outside the bay height. | Increase the bay Size, or use a smaller Box Collider for Trailer Bounds. |
| The HUD returns to the hitch instruction while you reverse. | T detached the trailer. | Drive forward until the hitches separate. Wait one second. Then reverse slowly into the trailer front. |
| The trailer jackknifes or jams. | The rig turned too far while it reversed. | Drive forward to straighten the trailer. If it stays stuck, select RETRY. Without the two Retry Spawn fields on the HUD, RETRY does not move the vehicles. |









