Main Content

Simulation 3D Actor

Define actors in 3D environment

Since R2022b

  • Simulation 3D Actor Block Mask

Libraries:
Simulink 3D Animation / Simulation 3D / Actors

Description

The Simulation 3D Actor block implements a generic actor in the Unreal Engine® viewer. You can use this block to specify actor name and source file, initialize the actor, and define how the actor is created and behaves during simulation.

Ports

Input

expand all

Instance number of actor, specified as a real integer.

  • For positive values, a new actor is created if it has not been created already. The reference block refers to this actor if the actor is present in the world.

  • For negative values, actor instances are deleted, if they exist. For example, instance 1 is deleted if the value of this port is -1 at a given time step.

Dependencies

This input is visible when the operating mode of the block is set to either Create at step or Reference by instance number.

Output

expand all

Validity of the specified actor, returned as false if the specified actor cannot be found in the world or true if the actor is found.

Parameters

expand all

Main

Name of the root actor for the current Simulation 3D Actor block.

Name of the parent actor of the actor, specified as a string.

Operating mode that determines block behavior, specified as one of these options.

  • Create at setup – Use this option to create actors in the scene. The actors are created during game setup, before the simulation runs. You can also control the simulation of these actors using the Input, Output, and Event ports.

  • Create at step – Use this option to dynamically create and delete actors when the simulation is running. An Instance input port of the type int is created in this mode, and the actors are dynamically generated based on the values input to the block. If the value of Instance is greater than zero, an actor with the name 'Actor name + Instance value' is created. The name of the actor is derived from 'Actor Name' in the block mask. The instance value is the current value of the port. When the value of Instance is negative, then the actor is deleted. Unlike the Create at setup option, you cannot control the actors created with this option selected in the block mask.

  • Reference by name – Use this option to refer to an actor in the scene using Actor Name, and control this actor's simulation using the inputs of the block. Get data of the actor using the outputs or events. This also provides a Valid output port.

    If an actor with the specified name is not present, the Valid port returns false or 0. In this case, default values will be passed as output for rest of the out ports (if any). Use the Valid port to verify whether the other outputs generated are currently valid or not.

    Note

    Source file and Initialization script parameters are unavailable in the Reference by name operating mode.

  • Reference by instance number – Use this option to refer to an instance created via a different actor block. Similar to the Create at step operating mode, this option creates an Instance input in the block, and the effective actor name 'Actor name + Instance value' is used to reference the actor.

    If an actor with the generated name is not present, the Valid port returns false or 0. In this case, default values are passed as output for rest of the output ports, if any. Use the Valid port to verify whether the other outputs generated are currently valid or not.

    Note

    Source file and Initialization script parameters are unavailable in the Reference by instance number operating mode.

Dependencies

The Transform tab is available if you set Operation as either Create at setup or Create at step.

File from which actors are sourced, specified as a string.

This option loads a 3D file or imports a sim3d.Actor object, including child actor objects from MAT or STL files.

Alternatively, the Select button can also be used to select a file from the Windows® file browser.

Text area to set properties of the actor created by the block, specified as a MATLAB® script. The order of actor creation is:

  1. Root actor with specified name is created.

  2. The Source file is loaded into the root actor.

  3. The Initialization script runs.

Use the name Actor when modifying the root actor of the block. Actor is a reserved handle in the initialization script. Otherwise, use the findBy function to get the actor handle of a different name, for example, one of the child actors. Then use the retrieved actor handle to initialize that specific actor. The Initialization script does not use the base workspace variables.

Sample time, Ts. The graphics frame rate is the inverse of the sample time.

If you set the sample time to -1, the block uses the sample time specified in the Simulation 3D Scene Configuration block.

Transform

The Transform tab is available if you set Operation as either Create at setup or Create at step.

Translation (x,y,z) of the actor object relative to its parent actor, specified as a real 1-by-3 vector, in meters.

Rotation (roll, pitch, yaw) of the actor object relative to its parent actor, specified as a real 1-by-3 vector, in radians.

Relative scaling in x, y and z coordinates, specified as a real 1-by-3 vector.

Inputs

This text area lists the user-selected input ports of the block and provides a button that opens the port selector app, which you can use to modify the input ports. Each line in the text area represents one block port.

You can manually modify the ports using the text area, but using the port selector app is recommended for choosing the ports.

Outputs

This text area lists the user-selected output ports of the block and provides a button that opens the port selector app, which you can use to modify the output ports. Each line in the text area represents one block port.

You can manually modify the ports using the text area, but using the port selector app is recommended for choosing the ports.

More About

expand all

Version History

Introduced in R2022b

expand all