Main Content

CharacterAsset

Character asset type

Since R2025a

    Description

    The CharacterAsset object represents an asset with the Character asset type in the RoadRunner project. You can use the CharacterAsset object to represent Character actors in the scenario.

    Creation

    You can create a CharacterAsset object in these ways:

    • The getAsset function extracts an object for the asset of the specified asset type at the specified path relative to the Asset folder of the specified project. Specify the assetType argument as "CharacterAsset" to extract a CharacterAsset object.

    • The createAsset function creates an asset of the specified asset type at the specified path relative to the Asset folder of the specified project. Specify the assetType argument as "CharacterAsset" to create a CharacterAsset object. The extension you specify for the new asset must match the type specified for the assetType argument.

    Properties

    expand all

    This property is read-only.

    Relative path to the asset in the RoadRunner project, represented as a string scalar.

    This property is read-only.

    Axis-aligned bounding box used for collision detection, represented as an AlignedBox object. The AlignedBox object contains the Min, Max, Center, and Extents properties which represent the dimensions of the collision box for the asset. RoadRunner represents each property as a three-element vector.

    Examples

    collapse all

    Use getAsset to extract a CharacterAsset object from your RoadRunner project. Then, use addActor and the newly created CharacterAsset object to add a Character actor to the scenario.

    This example assumes that you have prior knowledge of working with RoadRunner in MATLAB®. Before proceeding, follow the steps outlined in Set Up MATLAB Environment for RoadRunner Authoring Functions to set up your scenario using MATLAB functions for scenario authoring.

    Use the getAsset function to extract the CharacterAsset object myChar to represent the Citizen_Male.rrchar asset in the project prj. Then, use the addActor function to add a Character actor, citizenM, to the scenario scnro by specifying myChar as the asset to represent the new actor. Place the character actor citizenM at the world origin, specified as [0 0 0].

    myChar = getAsset(prj,"Characters/Citizen_Male.rrchar","CharacterAsset");
    citizenM = addActor(scnro,myChar,[0 0 0]);
    

    Character actors do not follow the default lane-following behavior in RoadRunner Scenario. Before you can run the simulation, you must first specify a route for them to follow. For information on programmatically creating routes, see Route and RouteSegment.

    Version History

    Introduced in R2025a

    See Also

    | | | |

    Topics