-
Notifications
You must be signed in to change notification settings - Fork 3
Function Library
zminton edited this page Sep 10, 2018
·
5 revisions
A Blueprint Function Library is an Unreal Engine 4 feature that allows certain functions to be reused over multiple projects. For the Trolley Mod, its main purpose is to provide a prepackaged set of functions to be used in the Level Blueprint of maps derived from CARLA’s native ones. The Trolley Mod only contains one, named “FunctionLibrary.” To view the Blueprint of a Function Library, right-click it and select “Edit Blueprint” from the dropdown menu.
Summary: run Trolley Mod simulations, which consist of a battery of scenarios one after another. Whenever a user collides with a victim, that result is recorded. Once all scenarios are complete, the simulation terminates and the results are written to a text file.
-
CollisionHandler: after the simulation detects the user colliding with some Actor in the level, it analyzes data about that Actor and formats it for output.
- Variables (none)
- Inputs
- FileName (string): the user-specified name of the output file.
- HitActor (Actor object reference): a reference to the Actor's model in the level which the user impacted.
- IsSingleTest (bool): indicates if a user is only running a single scenario instead of multiple ones. If true, the simulation terminates after all data is recorded for the currently chosen scenario. Otherwise, it continues to the next one.
- Locations (TargetPoint array): all the available places a user can spawn in the map, which indicates where all the scenarios exist. By stepping through this array, the user will proceed from one scenario to the next after each is completed.
- Output (string array): accumulates formatted strings to write to an output file once the simulation terminates.
- Overwrite (bool): if true, allow overwriting output files that share the name that the user specified. An important note: if the value is false and an output file that matches FileName exists, no data will be written!
- TestNum (integer): indicates which TargetPoint in the Locations array for the user to appear.
- Outputs
- NewRotator (Rotator): sets the user’s rotation when they appear at the next TargetPoint in the Locations array.
-
GoodHit: checks if the Actor collided by the user possesses the Tag "Wall." If it does, then the function returns false. Otherwise, it returns true.
- Variables (none)
- Inputs
- Actor (Actor object reference): a reference to the Actor's model in the level which the user impacted.
- Outputs
- GoodHit (bool): the result of the function checking if Actor contains the Tag named "Wall." If it does not, GoodHit is true.
-
InitValues: when the simulation begins, initialize the display, the player controller, the player's pawn, and the player's starting rotation.
- Variables (none)
- Inputs (none)
- Outputs
- HitDisplay (HitResult widget): a widget that displays text indicating what type of victim the player collided with.
- Locations (TargetPoint array): contains all of the Target Actors in the map, which is reference when finding the next scenario to send the user.
- PlayerPawn (Pawn object reference): the reference to the player Pawn controlled by the user.
- PlayerRotation (Rotator): the player's starting rotation.
- StartDisplay (StartMenu widget): display shown at the start of the simulation, allowing the user to select features such as the output file name and which mode to run the simulation in.
-
LogHit: formats data text into its final version before being written to the output file.
- Variables
- GroupMembers (Walker object reference array): temporarily stores all Walker Actors that are part of the same group so their data can be collectively stored.
- Temp (string): used to provide temporary storage for appending to an output string.
- Inputs
- HitActor (Actor object reference): the last Actor that the user had collided with.
- Output (string array): stores the data text in its final format before being written to an output file.
- Outputs (none)
- Variables
-
Warp: receives a TargetPoint Actor, moves the user to the location of that Actor, and sets the rotation of that user’s Pawn.
- Variables (none)
- Inputs
- Destination (TargetPoint object reference): the next location to move the user toward.
- Player (Pawn object reference): the Pawn the user controls.
- Outputs (none)
- Home
- Installation and setup
- Trolley Mod assets
- Modified CARLA assets
- Tutorial
- Videos