On this page
Module guide

Stunt Arena

Drive an RCCP 2 vehicle over marked ramps. Score points for airtime and for a landing that is centered and straight.

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-StuntArena.unitypackage, made with Export Module > Stunt Arena.

Installation order for Stunt Arena
  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.
  7. Use Assets > Import Package > Custom Package to import RCCP2-StuntArena.unitypackage.

Drive the example

Stunt Arena at the start of Play Mode
No. Item
1 RCCP dashboard: speed, gear and engine RPM
2 Score and landings
3 Current instruction
4 RETRY button
5 INFO button
6 Ramp 1
  1. Open Assets/RCCP 2 Driving Sandbox/Modules/StuntArena/Samples/Stunt Arena Example.unity.
  2. Enter Play Mode.
  3. Drive straight toward each ramp. Aim for 55 km/h at the ramp.
  4. Land on both marked pads. Aim for the inner white rectangles to earn target points.
  5. After the second valid landing, read Arena complete in the HUD. The run has no time limit.
  6. Select RETRY to clear the score and return to the start.
One run, from the first ramp to the result

Select INFO in the sample to see the controls, rules and setup steps.

The Info panel

Task result feedback

Stunt Arena result banner

The HUD shows a green banner after you score on every ramp. After a failed jump or a landing outside an enabled target, the HUD status shows an amber message. You can attempt a missed jump again during the same run. The HUD keeps the arena 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
Throttle W or Up Arrow
Brake and reverse S or Down Arrow
Steer A / D or Left / Right Arrow
Handbrake Space
Change camera C
Stunt Arena keys

Use it in your scene

If you use the complete Driving Sandbox, open your scene. Select your RCCP vehicle in the Hierarchy. On the Stunt Arena card, select Add to Scene.

Keep the ground flat under the course. The course is about 146 m long and starts about 50 m in front of the vehicle. Complete any other steps in the setup dialog.

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

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 Assets/Realistic Car Controller Pro 2/Prefabs/Prototype/RCCP_Sedan01.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.

  1. Add Prefabs/Stunt Arena.prefab to your scene. For a custom course, select an empty GameObject. Select Add Component > BoneCracker Games > Driving Sandbox > Stunt Arena > Stunt Arena Challenge.
  2. If you use the prefab, place it on flat ground at the height of the prefab root. The prefab is a two-ramp course about 146 m long and 10 m wide.
  3. Keep about 50 m of flat run-up before Ramp 1, as in the sample.
  4. Assign your RCCP vehicle to Vehicle. Drag the vehicle from the Hierarchy. If your code spawns the vehicle, set Vehicle after the spawn. If you use the prefab, continue with step 11.
  5. Select the object at the lip of each ramp. Select Add Component > BoneCracker Games > Driving Sandbox > Stunt Arena > Stunt Ramp. Point the local Z axis in the driving direction.
  6. Assign the solid collider at the lip to Takeoff Surface.
  7. Assign a separate solid Box Collider to Landing Pad. Point the pad's local Z axis along the landing direction.
  8. Select each ramp. Check that the green arrow points along the driving direction. See Ramp gizmos.
  9. Mark each landing pad so the player can see its edges.
  10. Assign each ramp once to Ramps on the challenge.
  11. Put the vehicle at the start of the course. Create an empty GameObject with the position and rotation of the vehicle root. Keep the spawn at the vehicle root height. Assign the object to Retry Pose.
  12. Optional: use On Arena Completed to connect the end of the run to your game.
  13. For the HUD, add Prefabs/Stunt Arena HUD.prefab. The prefab has its own Canvas.
  14. Assign the challenge to Challenge on the HUD. Keep the assigned Status text and Retry button. The HUD connects the button in code. Do not add Retry() to the button's On Click () list.
  15. If the scene has no EventSystem, select GameObject > UI > Event System. Use an Input System UI Input Module on the EventSystem.
Stunt Arena: 1 Vehicle, 2 Ramps, 3 Retry Pose. Stunt Arena HUD: 1 Challenge
Stunt Ramp: 1 Takeoff Surface, 2 Landing Pad, 3 Bonus Target, 4 Bonus Target Size, 5 Bonus Points
The two-ramp course

The INFO panel in the HUD describes the example. Change the text or delete the INFO button in your scene.

If Retry Pose is empty, the challenge uses the vehicle pose at enable time or at vehicle assignment.

The run ends when the vehicle scores on every ramp. The challenge then ignores further jumps until RETRY or ResetRun().

Ramp gizmos

Select a Stunt Ramp to see its gizmos in the Scene view.

The gizmos of Ramp 1
Gizmo Meaning
Green line across the lip and green arrow The takeoff lip and the driving direction. The vehicle must drive forward within 60° of the arrow.
Green line behind the lip, with a short cross line at its end The takeoff zone. Wheel contact in this zone can start a jump. The zone extends Takeoff Depth behind the lip and 0.25 m past it.
Blue box and blue arrow The Landing Pad collider and the landing direction.
Yellow rectangle The optional bonus target.

Targets on the landing pads

Ramp 1 has a wide target worth 40 points. Ramp 2 has a narrower precision target worth 100 points. A valid pad landing completes the ramp and earns the base points.

  1. Place an empty GameObject at the center of the target. Match its up axis to the landing pad.
  2. Assign the GameObject to Bonus Target on the ramp. Use a marker with a world scale of 1.
  3. Set Bonus Target Size to the width and length in meters. Keep the target rectangle inside the landing pad.
  4. Set Bonus Points from 0 to 1000. Enter 0 to disable the target.
  5. Mark the target edges with visible objects. Keep the objects free of colliders.

For a valid landing, the challenge checks the Rigidbody position at the first wheel contact. The position must be on or inside the target outline to earn the bonus. If Bonus Target is empty, the ramp uses its base score.

Points

The vehicle must leave the takeoff surface near the lip while driving forward. The default takeoff depth is 2.5 m.

All live RCCP wheels must stay clear of the ground for at least 0.25 s. At the first physics step with ground contact, each grounded wheel must contact the top of the matching pad. The Rigidbody position must be inside the pad rectangle. The default heading limit is 35°. The default tilt limit is 55°.

Component Points
Airtime 100 points per second
Landing precision Up to 100 points for position, heading and tilt
Target The configured bonus for a valid landing inside the target
The points of one measured run on the example course

The challenge awards points once per ramp in each run. A failed jump clears the active attempt. A new jump can score on the same ramp. The challenge stops an attempt after 3 s of airtime by default. The challenge interrupts attempts during RCCP replay or after a large position change in one physics step.

Script reference

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

Member Purpose
Vehicle Assign the RCCP vehicle at runtime. A different vehicle clears the run and gives a new start pose.
Score, LandingsCompleted, RampCount Read the run score and progress.
ActiveRamp, CurrentAirTime Read the active jump.
LastResult, LastPoints, LastAirTime, LastLandingAccuracy Read the last attempt.
LastLandingPosition, LastTargetBonus, LastTargetPointsAvailable Read the position and target points for the last valid landing. A failed or interrupted attempt clears them.
HasScored(ramp) Check whether a ramp already has points.
IsConfigured True when the ramp setup is valid and a vehicle is assigned.
IsComplete, OnArenaCompleted Read completion or subscribe to the completion event.
ResetRun() Clear the run and leave the vehicle in place.
Retry() Clear the run and return the vehicle to the start. During a replay it does nothing.
StuntRamp.LandingPad, TargetBonusPoints Read the landing collider, and the available bonus or zero.
StuntRamp.GetTargetBonus(position) Read the bonus at a world position. The challenge checks the landing separately.

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 Assign the Challenge on this HUD. Challenge on the HUD is empty. Drag the Stunt Arena object from the Hierarchy into Challenge.
The HUD shows Assign a Vehicle on the challenge. Vehicle on the challenge is empty. Drag the vehicle from the Hierarchy, or set Vehicle after your code spawns it.
The HUD shows Check the ramp setup in the Console. A ramp has a missing, shared or trigger collider, or Ramps is empty or has an empty or repeated element. Read the Stunt Arena warning in the Console. Change the field that the warning names.
A jump never starts and the HUD stays at Drive toward the first ramp. The ramp's local Z axis points against the driving direction. Select the ramp. Turn it until the green arrow points along the driving direction.
RETRY does nothing. The Retry field on the HUD is empty. Drag the HUD's RETRY button into the Retry field.
The HUD buttons do not respond to clicks. The EventSystem or its Input System UI Input Module is missing. Add the missing object or component.