sim3d.Actor
Object used to define actors in the Unreal Engine viewer
Description
Use the sim3d.Actor
object for user-defined Unreal Engine® C++ or blueprint actors.
Creation
Description
creates a default actor
object that represents all items in the virtual reality world.actor
= sim3d.Actor
specifies additional options using one or more name-value arguments.actor
= sim3d.Actor(___,Name,Value
)
Input Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN
, where Name
is
the argument name and Value
is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Example: actor1 = sim3d.Actor('ActorName','vehicle1','Translation', [3, 4, 3],
'Rotation', [], 'Scale',[1 2 1])
ActorName
— Name of actor
autogenerated name (default) | character array | string
Name of actor, specified as a character array or string. If an actor name is not specified, then the actor is assigned an autogenerated name.
Note
If you specify the same name as an actor that already exists, then the actor name you specify is appended with a unique identifier to differentiate it.
Translation
— Relative translation
[0,0,0]
(default) | real 1-by-3 vector
Relative translation
(x,y,z) of the actor
object to its parent actor, specified as a real 1-by-3 vector, in meters. Use this
argument to set the Translation
property of the
sim3d.Actor
object.
Data Types: double
Rotation
— Relative rotation
[0,0,0]
(default) | real 1-by-3 vector
Relative rotation (roll, pitch, yaw) of the actor object to its parent actor,
specified as a real 1-by-3 vector, in radians. Use this argument to set the
Rotation
property of the sim3d.Actor
object.
Data Types: double
Scale
— Relative scaling
[1,1,1]
(default) | real 1-by-3 vector
Relative scaling in x, y and
z coordinates, specified as a real 1-by-3 vector. Use this name
value argument to set the Scale
property of the
sim3d.Actor
object.
Data Types: double
ActorClassId
— Semantic segmentation map of object class identifiers
0
(default) | m-by-n array
Semantic segmentation map of object class identifiers, returned as an m-by-n array. m is the vertical resolution of the image, and n is the horizontal resolution of the image.
The table shows the object IDs used in the default scenes that available in the
Simulation 3D Scene
Configuration block. If you are using a custom scene, you can assign new
object types to unused IDs. If a scene contains an object that does not have an
assigned ID, that object is assigned an ID of 0
. The detection of
lane markings is not supported.
ID | Type |
---|---|
0 | None/default |
1 | Building |
2 | Not used |
3 | Other |
4 | Pedestrians |
5 | Pole |
6 | Lane Markings |
7 | Road |
8 | Sidewalk |
9 | Vegetation |
10 | Vehicle |
11 | Not used |
12 | Generic traffic sign |
13 | Stop sign |
14 | Yield sign |
15 | Speed limit sign |
16 | Weight limit sign |
17-18 | Not used |
19 | Left and right arrow warning sign |
20 | Left chevron warning sign |
21 | Right chevron warning sign |
22 | Not used |
23 | Right one-way sign |
24 | Not used |
25 | School bus only sign |
26-38 | Not used |
39 | Crosswalk sign |
40 | Not used |
41 | Traffic signal |
42 | Curve right warning sign |
43 | Curve left warning sign |
44 | Up right arrow warning sign |
45-47 | Not used |
48 | Railroad crossing sign |
49 | Street sign |
50 | Roundabout warning sign |
51 | Fire hydrant |
52 | Exit sign |
53 | Bike lane sign |
54-56 | Not used |
57 | Sky |
58 | Curb |
59 | Flyover ramp |
60 | Road guard rail |
61 | Bicyclist |
62-66 | Not used |
67 | Deer |
68-70 | Not used |
71 | Barricade |
72 | Motorcycle |
73-255 | Not used |
Dependencies
To enable this port, on the Simulation 3D Scene Configuration block, select Output semantic segmentation on the Ground Truth tab.
In addition to these name-value arguments, you also can specify any of the properties on this page as name-value arguments.
Output Arguments
actor
— Actor object
sim3d.Actor
object
Actor object, returned as a sim3d.Actor
object. A unique
identifier and unique name is assigned to the actor. You can change the actor name,
but the unique identifier is associated with the actor until the actor is deleted. The
virtual reality world is composed of a hierarchical structure of actors.
Properties
Base Attributes
UserData
— Structure to hold actor data
structure
Structure to hold actor data, specified as a structure. You can update and maintain this data and use it to update the fields of the structure during simulation or in the setup method.
Parent
— Parent of actor
handle to parent sim3d.actor
object
Parent of actor, specified as a handle to the parent
sim3d.Actor
object. You can set this property using the
Parent
argument.
Children
— Children of actor
handle to children sim3d.actor
object
Children of actor, specified as a handle to the sim3d.Actor
object.
This property is read only.
ParentWorld
— Parent world method handle
handle to parent sim3d.World
object
This property is read only.
Parent world method handle, specified as a handle to the parent
sim3d.Actor
object.
Translation
— Cartesian coordinates for actor position
[0,0,0]
(default) | real 1-by-3 vector
Cartesian coordinates for actor position in the Unreal® Editor scene, specified as a real 1-by-3 vector. You can set this
property using the
Translation
argument.
Rotation
— Rotation of actor
[0,0,0]
(default) | real 1-by-3 vector
Rotation of actor in the Unreal Editor scene, specified as a three element vector. You can set this
property using the
Rotation
name value argument.
Scale
— Scale of actor
[1,1,1]
(default) | real 1-by-3 vector
Scale of actor used for scaling in each of three directions in the Unreal Editor scene, specified as a real 1-by-3 vector. You can set this
property using the
Scale
argument.
Mobility
— Type of actor mobility
'sim3d.utils.MobilityTypes.Movable'
(default) | 'sim3d.utils.MobilityTypes.Static'
Type of actor mobility to respond to physics and/or move the actor during
simulation, specified as 'sim3d.utils.MobilityTypes.Movable'
or
'sim3d.utils.MobilityTypes.Static'
.
Data Types: string
Mesh Attributes
Vertices
— Vertices of mesh geometry
empty array (default) | real n-by-3 vector
Vertices of the mesh geometry, specified as a real n-by-3 vector, where n is the number of vertices.
Example: actor.Vertices = [1, 2, 3; 43, 54, 65]
Data Types: double
Faces
— Vertices of each triangle
empty array (default) | real n-by-3 vector
Vertices of each triangle, specified as a real n-by-3 vector, where n is the number of vertices. You can use this property to define how each triangle of the mesh is drawn.
Example: actor.Faces = [1, 2, 3; 4, 5, 6]
Data Types: double
Normals
— Normals of each vertex
empty array (default) | real n-by-3 vector
Normals of each vertex, specified as a real n-by-3 vector,
where n is the number of vertices. Normals
must be of the same length as Vertices
.
Example: actor.Normals = [1, 2, 3; 43, 54, 65]
Data Types: double
TextureCoordinates
— Texture coordinates
empty array (default) | real n-by-2 vector
Texture coordinates for each vertex, specified as a real n-by-2
vector, where n is the number of vertices. This argument is
optional, and if specified, must be the same length as
Vertices
.
Example: actor.TextureCoordinates = [1 2;3 4]
VertexColors
— Vertex colors
empty array (default) | real n-by-3 vector
Vertex colors, specified as a real n-by-3 vector, where
n is the number of vertices. This argument is optional, and if
specified, must be the same length as Vertices
.
Example: actor.VertexColors = [1, 2,3; 4, 5, 6]
Material Attributes
Color
— Base color of actor
[1,1,1]
(default) | real 1-by-3 vector
Base color of actor, specified as a real 1-by-3 vector. Color
consists of a vector of color RGB components [red green blue]
.
Values greater than 1
cause glowing and can be used for various
indicators. If the sim3d.Actor
object has a texture, the TextureMapping.Blend
coefficient can be
used to control how it blends with the base color.
Example: actor.Color = [0.3 0.27 0.9]
Transparency
— Transparency of actor
0
(default) | real positive number in the range (0,1)
Transparency of actor, specified as a real positive number in the range (0,1), where 0 indicates a nontransparent object and 1 indicates a completely transparent object.
Example: actor.Transparency = 0.8
Data Types: double
Shininess
— Shininess of actor
0.7
(default) | real positive number in the range (0,1)
Shininess of actor, specified as a real positive number in the range (0,1), where 0 indicates a nonshiny object and 1 indicates a completely shiny object.
Example: actor.Shininess = 0.3
Data Types: double
Metallic
— Metallic look of actor
0.7
(default) | real positive number in the range (0,1)
Metallic look of actor, specified as a real positive number in the range (0,1), where 0 indicates a plastic surface and 1 indicates a metallic surface.
Example: actor.Metallic = 0.1
Data Types: double
Flat
— Flat shading factor of actor
0
(default) | real positive number in the range (0,1)
Flat shading factor of actor, specified as a real positive number in the range (0,1), where 0 indicates a smooth surface and 1 indicates a faceted surface.
Example: actor.Flat = 0.7
Data Types: double
Tessellation
— Tessellation factor of actor
0 (default) | real positive integer in the range (0,8)
Tessellation factor of actor, specified as a real positive integer in the range (0,8). Use this property to specify the coefficient of automatic geometry refinement. This property can be useful when texture displacement mapping is used.
Example: actor.Tessellation = 5
VertexBlend
— Color blending coefficient of vertices
0 (default) | real positive number in the range (0,1)
Color blending coefficient of vertices, specified as a real positive number in the range (0,1). This value can be larger to achieve the effect of glowing colors..
Example: actor.VertexBlend = 0.5
TextureTransform
— Texture transformations applied to actor texture
real positive vector
Texture transformations applied to actor texture, specified as a real positive
scalar. Use TextureTransform
to define texture position, velocity,
scale, and angle.
Transformation Properties
Property | Detail | Value | Value Example |
---|---|---|---|
Position | Use this property to set the position of the texture. You can use
|
| actor.TextureTransform.Position = [2, 3] |
Velocity | Use this property to set the velocity of the texture movement. velocity is expressed as a change of U and V coordinates per second of simulation time. The animated surface has no effect on physical interactions. |
| actor.TextureTransform.Velocity = [2, 3] |
Scale | Use this property to set the relative texture scale. If the texture is smaller than the surface to be covered, the scale repeats automatically in all directions. Negative values can be used to flip the texture in corresponding coordinate. |
| actor.TextureTransform.Scale = [2, 2] |
Angle | Use this property to set the relative texture angle. The texture rotates always around its center point [0.5, 0.5] in the UV coordinates. The center is fixed to the texture and moves with it depending on the Position and Velocity parameters.. Negative values can be used to flip the texture in corresponding coordinate. |
| actor.TextureTransform.Angle = pi/2 |
TextureMapping
— Texture mapping parameters applied to actor texture
real positive vector
Texture mapping parameters applied to actor texture, specified as a real positive
vector. Use TextureMapping
to define texture blend, displacement,
bump factor, and roughness.
Mapping Properties
Property | Detail | Value | Value Example |
---|---|---|---|
Blend | Use this property to set the blend ratio of the texture. You can use To create an effect of glowing texture, use a black base color ([0 0 0]) and blend values greater than 1. You can set the value independently for each color channel ([red green blue]). |
| actor.TextureMapping.Blend = [1 1 0.5] |
Displacement | Use this property to set the displacement of the texture. You can use You can set the value independently for each color channel ([red green blue]) and its range is unlimited. |
| actor.TextureMapping.Displacement = [1 2 5] |
Bumps | Use this property to set the bump factor of the texture. You can use You can set the value independently for each color channel ([red green blue]) and its range is unlimited. |
| actor.TextureMapping.Bumps = [10 10 0.5] |
Roughness | Use this property to set the roughness factor of the texture. You can use You can set the value independently for each color channel ([red green blue]) and its range is unlimited. |
| actor.TextureMapping.Roughness = [1 1 0.5] |
Texture
— Source file for actor shape
'' (default) | character array
Source file for actor shape, specified as a character array. The supported file types are JPEG, PNG, BMP, and TGA. The filepath should be absolute.
Example: actor.Texture = "file.jpg"
Physical Attributes
Shadows
— Actor shadows
0
or false
(default) | 1
or true
Actor shadows, specified as 0
(false
) if the
actor does not cast shadows or 1
(true
) if it
does.
LinearVelocity
— Linear velocity of actor
(0,0,0)
(default) | real positive vector
Linear velocity of actor in local coordinates, specified as a real positive vector, in meters per second.
Example: actor.LinearVelocity = [1 1 1]
Dependencies
Mobility
should be set to
'sim3d.utils.MobilityTypes.Movable'
for velocities to work.
Otherwise the actor will not move, and you will see a warning.
AngularVelocity
— Angular velocity of actor
(0,0,0)
(default) | real positive vector
Angular velocity of actor in local coordinates, specified as a real positive vector, in radians per second.
Example: actor.AngularVelocity = [2 2 2]
Dependencies
Mobility
should be set to
'sim3d.utils.MobilityTypes.Movable'
for velocities to work.
Otherwise the actor will not move, and you will see a warning.
Mass
— Mass of actor
0
(default) | real positive scalar
Mass of actor, specified as a real positive scalar, in kilograms.
Example: actor.Mass = 12
CenterOfMass
— Center of mass of actor
(0,0,0)
(default) | real positive vector
Center of mass of sim3d.Actor
object, specified as a real positive vector. Use this property to shift the center of
gravity from the origin of the local coordinate system.
Example: actor.CenterOfMass = [1 0 1 ]
Gravity
— Application of gravity to actor
0
or false
(default) | 1
or true
Application of gravity to actor, specified as 0
(false
) if no gravity is applied or 1
(true
) if gravity is applied.
Example: actor.Gravity = false
Dependencies
This property works when
Physics
property is set to1
ortrue
.Mobility
should be set to'sim3d.utils.MobilityTypes.Movable'
for the actor to experience the effects of gravity. Otherwise the actor will not move, and you will see a warning.
Physics
— Reaction of actor to physical forces
0
or false
(default) | 1
or true
Reaction of actor to physical forces such as gravity and collision, specified as
0
(false
) or 1
(true
).
If Physics
is enabled, the actor moves independently of its
parent actor object but together with its children, unless the children also have
Physics
enabled.
Example: actor.Physics = true
Collisions
— Object collision
0
or false
(default) | 1
or true
Object collision, specified as 0
(false
) for
no collision or 1
(true
) if objects will
collide.
Example: actor.Collisions = true
LocationLocked
— Stationary translational motion
0
or false
(default) | 1
or true
Stationary translational motion, specified as either 0
(false
) or 1
(true
). If
this property is enabled, the actor is fixed in place. If the actor has defined a
nonzero linear velocity, it interacts with other objects as if it were moving itself.
You can use this property to model belt conveyors.
Example: actor.LocationLocked = true
RotationLocked
— Stationary rotational motion
0
or false
(default) | 1
or true
Stationary rotational motion, specified as either 0
(false
) or 1
(true
). If
this property is enabled, the sim3d.Actor
object is fixed in place. If the actor has defined a nonzero angular velocity, it
interacts with other objects as if it were moving itself. You can use this property to
model circular conveyors (carousels).
Example: actor.RotationLocked = true
Object Functions
copy | Copy all properties from another actor |
findBy | Find all actors that match specified criteria |
propagate | Propagate value of selected property to actor and its children |
gather | Return values of selected property from all objects in selected branch |
takeSnapshot | Take snapshot of selected properties |
restoreSnapshot | Restore actor to state of properties saved in specified snapshot |
createMesh | Create new mesh with specified values |
addMesh | Add mesh on top of current mesh |
load | Load or import 3D file |
save | Save actor and children to a MAT file |
createShape | Create geometry for basic primitives |
Version History
Introduced in R2022b
Comando de MATLAB
Ha hecho clic en un enlace que corresponde a este comando de MATLAB:
Ejecute el comando introduciéndolo en la ventana de comandos de MATLAB. Los navegadores web no admiten comandos de MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)