Main Content

Node

R2026b

Specify 3D mesh node

Since R2026b

    Description

    A Node object represents a 3D mesh, such as vehicles, buildings, or terrain, in the RoadRunner Viewer scene graph. Use a Node object to modify the color and transforms of the corresponding 3D mesh.

    Creation

    The addMeshNode function adds a 3D mesh node, using the asset in the specified path, to the scene graph of the specified RoadRunner Viewer object. To specify for a Node object to be a child of another 3D mesh node, set the ParentNode argument to the desired parent Node. For example, childCar = addMeshNode(rrViewer,Filepath="Vehicles/Sedan.fbx",ParentNode=sedan); adds a new mesh node, childCar, that uses the Sedan.fbx asset to the scene graph and specifies childCar as a child node sedan.

    Properties

    expand all

    This property is read-only.

    Name of the 3D mesh node, represented as a string scalar or character vector.

    This property is read-only.

    Child nodes of this node, represented as an array of Node objects. RoadRunner Viewer positions child nodes relative to their parent. If you remove a parent node from the scene graph, RoadRunner Viewer also removes its children.

    If you use addMeshNode and set the Structure argument to "rigid", this property is empty because RoadRunner Viewer flattens the mesh hierarchy.

    Transform matrix of the 3D mesh node, in local coordinates, specified as a 4-by-4 matrix.

    If the node is a child of another node, the LocalTransform property is relative to the origin of the parent.

    This property is read-only.

    Transform matrix of the 3D mesh node, in world coordinates, represented as a 4-by-4 matrix.

    Object Functions

    setPaintColorSpecify 3D mesh node color

    Examples

    collapse all

    Add a 3D mesh node that uses the Sedan.fbx asset from your RoadRunner project to the RoadRunner Viewer scene graph.

    This example assumes you have already added the folder containing the RoadRunner API to your MATLAB® path and created a project folder. For information on getting started with RoadRunner Viewer, see Get Started with RoadRunner Viewer (RoadRunner Scenario).

    Specify the path to a project folder. RoadRunner Viewer uses the 3D mesh, material, and image files in the Assets folder of the specified project.

    If you do not have a project folder and want to create one that already contains an Assets folder with sample files, create a RoadRunner project. By default, RoadRunner projects contain an Assets folder prepopulated with sample assets, such as a Sedan.fbx file, that you can use in RoadRunner Viewer. For information on creating a RoadRunner project, see RoadRunner Project and Scene System (RoadRunner).

    myProject="C:\users\MyProject"

    Open RoadRunner Viewer and specify your project folder.

    rrViewer = roadrunnerViewer(ProjectFolder=myProject);
    

    To create a Node object and add a 3D mesh to RoadRunner Viewer, use the addMeshNode function and specify the path to the 3D asset you want to import. The path you specify must be relative to the Assets folder in your project.

    sedan = addMeshNode(rrViewer, Filepath="Vehicles/Sedan.fbx");

    To modify the position and orientation of the 3D mesh, modify the LocalTransform property of the Node object sedan. To modify the color of the 3D mesh, use the setPaintColor function.

    sedan.LocalTransform(1,4) = 10;
    setPaintColor(sedan,[0.85 0.1 0.1]);

    Version History

    Introduced in R2026b