sim3d.Actor
Description
Use the sim3d.Actor
object for user-defined actors in virtual
world with sim3d.World
object.
Creation
Description
creates a default actor
object that represents all items in the virtual 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], 'OnHit', @hitcallback)
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, specified as an array.
OnHit
— Custom hit event callback function handle
handle to user-defined function
Custom hit event callback function handle, specified as the handle to the
user-defined function such as @hitcallback
. Use the function to
pass the actor handle as the input argument to access sim3d.Actor
properties during hit event.
Example: function hitcallback(Actor)
OnBeginOverlap
— Custom begin overlap event callback function handle
handle to user-defined function
Custom begin overlap event callback function handle, specified as the handle to
the user-defined function such as @beginoverlapcallback
. Use
the function to pass the actor handle as the input argument to access
sim3d.Actor
properties during begin overlap event.
Example: function beginoverlapcallback(Actor)
OnEndOverlap
— Custom end overlap event callback function handle
handle to user-defined function
Custom end overlap event callback function handle, specified as the handle to
the user-defined function such as @endoverlapcallback
. Use the
function to pass the actor handle as the input argument to access
sim3d.Actor
properties during end overlap event.
Example: function endoverlapcallback(Actor)
OnClick
— Custom click event callback function handle
handle to user-defined function
Custom click event callback function handle, specified as the handle to the
user-defined function such as @clickcallback
. Use the function
to pass the actor handle as the input argument to access sim3d.Actor
properties during click event.
Example: function clickcallback(Actor)
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 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
This property is read-only.
Children of actor, specified as a structure. Each field of structure contains a
handle to the child of sim3d.Actor
object.
ParentWorld
— Parent world handle
handle to parent sim3d.World
object
Parent world handle, specified as a handle to the parent
sim3d.World
object. You can use this property only with actors
added to the world.
CoordinateSystem
— Actor orientation
'Default'
(default) | 'MATLAB'
| 'ISO8855'
| 'AERO'
| 'VRML'
| 'SAE'
Actor orientation representation in the virtual world, specified as
'Default'
, 'MATLAB'
,
'ISO8855'
, 'AERO'
, 'VRML'
,
or 'SAE'
. The values are not case sensitive. To display the actor
transformation in the specified coordinate system, set this property first and then
the transform properties Translation
, Rotation
,
and Scale
.
Coordinate System | Description | |
---|---|---|
'Default' | The default coordinate system, in m and rad. Axes
Rotation
|
|
'MATLAB' | The MATLAB® coordinate system, in m and rad. Axes
Rotation
|
|
'ISO8855' | The ISO 8855 standard coordinate system, in m and deg. For more information, see ISO Standards. Axes
Rotation
|
|
'AERO' | The coordinate system for Aerospace applications, in m and rad. For more information, see Body Coordinates (Aerospace Blockset). Axes
Rotation
|
|
'VRML' | The X3D ISO standard coordinate system, in m and rad. Axes
Rotation
|
|
'SAE' | The SAE J670 standard coordinate system, in m and rad. For more information, see SAE International Standards. Axes
Rotation
|
|
Translation
— Cartesian coordinates for actor position
[0,0,0]
(default) | real 1-by-3 vector
Cartesian coordinates for actor position in the virtual world, 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 virtual world, 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 virtual world,
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.Static'
(default) | 'sim3d.utils.MobilityTypes.Movable'
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: sim3d.utils.MobilityTypes
Mesh Attributes
Vertices
— Vertices of mesh geometry
empty array (default) | N-by-3 matrix
Vertices of mesh geometry, specified as an N-by-3 matrix. This matrix includes the coordinates of all vertex positions to be used for the mesh geometry. Each vertex has a vertex ID equal to its row number in the matrix. N specifies the number of vertices.
Example: actor.Vertices = [-1 -1 0; 1 -1 0; 1 1 0; -1 1 0; -1 -1 0; 1 -1
0;1 1 0;-1 1 0]
Data Types: double
Faces
— Vertices of each triangular face
empty array (default) | M-by-3 matrix
Vertices of each triangular face, specified as an M-by-3 matrix. This matrix defines how each triangle of the mesh is drawn. The matrix specifies the vertex IDs that define each triangular face of the mesh. M is the number of triangular faces in the mesh.
Example: actor.Faces = [0 3 2; 0 2 1; 4 6 7; 4 5
6]
Data Types: double
Normals
— Normal vectors of each vertex
empty array (default) | N-by-3 matrix
Normal vectors of each vertex, specified as an N-by-3 matrix.
Each row of the matrix specifies the normal vector for a vertex. This matrix must be
the same size as Vertices
.
Example: actor.Normals = [0 0 1; 0 0 1; 0 0 1; 0 0 1; 0 0 -1; 0 0 -1; 0 0
-1; 0 0 -1]
Data Types: double
TextureCoordinates
— Texture coordinates
empty array (default) | N-by-2 matrix
Texture coordinates for each vertex, specified as an N-by-2
matrix. This matrix defines which point on the texture file maps to each vertices.
This argument is optional and, if specified, must be the same length as
Vertices
.
Example: actor.TextureCoordinates = [0 0; 0 1; 1 1; 1 0; 0 0; 0 1; 1 1; 1
0]
VertexColors
— Vertex colors
empty array (default) | N-by-3 matrix
Vertex colors, specified as an N-by-3 matrix. This matrix
specifies the color value of each vertex in [R G B]
form. This
matrix must be the same length as Vertices
.
Note
To display VertexColors
along with the actor base color,
set the VertexBlend
property to a value greater than 0. If
VertexBlend
is 1, then actor displays only the
VertexColors
.
Example: actor.VertexColors = [1 0 0; 0 1 0; 0 0 1; 1 0 1; 1 1 0; 0 1 1; 1
1 0; 0 1 0]
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 an opaque 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)
Flat shading factor of actor, specified as a real positive number in the range (0,1), where 0 indicates a smooth shading and 1 indicates a faceted shading.
Example: actor.Flat = 0.7
Data Types: double
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.
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), where 0 indicates to display only the base color and 1 indicates to display only the vertex color. This value indicates how much of the base color blends with the specified vertex color.
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] |
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 texture
'' (default) | character array
Source file for texture, specified as a character array. The supported file types are JPEG, PNG, and BMP. The filepath should be absolute.
Note
For BMP files, only 8-bit files are supported.
Example: actor.Texture = fullfile(pwd,
"file.jpg")
TwoSided
— Two-sided visibility of actor surface
0
or false
(default) | 1
or true
Two-sided visibility of actor surface, specified as 0
(false
) if the actor is visible only from the outer side or
1
(true
) if the actor is visible from both the
inner and outer sides. When this property is false
, actor
performance improves, as the polygons facing away from the camera viewpoint are not
rendered.
Example: actor.TwoSided = 1
Physical Attributes
LinearVelocity
— Linear velocity of actor
(0,0,0)
(default) | real 1-by-3 vector
Linear velocity of actor, specified as a real 1-by-3 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 1-by-3 vector
Angular velocity of actor, specified as a real 1-by-3 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
.PreciseContact
property is set to0
orfalse
.
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
Dependencies
This property works when PreciseContact
property is set to
0
or false
.
Collisions
— Object collision
1
or true
(default) | 0
or false
Object collision, specified as 0
(false
) for
no collision or 1
(true
) if objects will
collide.
Example: actor.Collisions = false
PreciseContacts
— Precise contacts
0
or false
(default) | 1
or true
Precise contacts during collisions, specified as 0
(false
) or 1
(true
).
Setting this value to true
allows the Unreal Engine® to use a collision box that follows the actor mesh precisely. This
setting allows the software to detect collisions accurately.
Example: actor.PreciseContacts = true
Dependencies
Setting
PreciseContacts
property totrue
for an actor disables thePhysics
andGravity
properties.This property is not run-time configurable.
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
Dependencies
Physics
should be set to false
.
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
Dependencies
Physics
should be set to false
.
Hidden
— Option to hide actor
0
or false
(default) | 1
or true
Option to hide the actor from the virtual world scene, specified as
0
(false
) if the actor is visible in the scene
or 1
(true
) if the actor is hidden in the
scene.
Example: actor.Hidden = 1
Friction
— Dynamic friction
0.7 (default) | real positive number in the range (0,1)
Dynamic friction, dimensionless, specified as a real positive number in the range (0,1). This property indicates the ease with which two actors can slide over each other. The value can only change in discrete steps of 0.1. When two actors slide over each other, the friction is the average value of both actors.
Example: actor.Friction = 0.4
Restitution
— Coefficient of restitution
0.3 (default) | real positive number in the range (0,1)
Coefficient of restitution, dimensionless, specified as a real positive number in the range (0,1). This property indicates how bouncy the collision is between two actors. The value can only change in discrete steps of 0.1. When two actors collide with each other, the coefficient of restitution is the average value of both actors.
Example: actor.Restitution = 0.5
Force
— Force applied to actor
(0,0,0)
(default) | real 1-by-3 vector
Force applied to actor, specified as real a 1-by-3 vector, in N. The acceleration
of the actor depends on the Mass
property of the actor and the
size of the simulation step specified by sampleTime
in run
.
Example: actor.Force = [0 5 0]
Dependencies
Physics
should be set to true
.
Torque
— Torque applied to actor
(0,0,0)
(default) | real 1-by-3 vector
Torque applied to actor, specified as a real 1-by-3 vector, in Nm. The angular
acceleration of the actor depends on the Mass
property of the
actor and the size of the simulation step specified by sampleTime
in run
.
Example: actor.Torque = [0 pi/2 0]
Dependencies
Physics
should be set to true
.
Event Attributes
Events
— Option to report actor events
1
or true
(default) | 0
or false
Option to report actor events, specified as 0
(false
) or 1
(true
). This
table provides the required events and collision property settings to report
events.
Event | Report Event Description | Actor Events Property | Actor Collision Property |
---|---|---|---|
Hit | Actor 1 collides with Actor 2 | Actor 1 – Actor 2 –
| Actor 1 – Actor 2 –
|
BeginOverlap | Actor 1 starts to overlap with Actor 2 | Actor 1 – Actor 2 –
| Actor 1 – Actor 1 –
|
EndOverlap | Actor 1 stops overlapping with Actor 2 | Actor 1 – Actor 2 –
| Actor 1 – Actor 2 –
|
ClickEvent | You click Actor 1 | Actor 1 – | NA |
Example: actor.Events = true
HitEvent
— Hit event
0
or false
| 1
or true
This property is read-only.
Hit event for sim3d.Actor
object, specified as 0
(false
) or
1
(true
).
HitSelfID
— Hit sim3d.Actor
object identifier
real positive integer
This property is read-only.
Hit sim3d.Actor
object identifier, specified as a real positive integer.
HitOtherID
— Identifier of actor that collides with sim3d.Actor
object
real positive integer
This property is read-only.
Identifier of actor that collides with the sim3d.Actor
object, specified as a real positive integer.
HitLocation
— Hit event location
[0,0,0]
(default) | real 1-by-3 vector
This property is read-only.
Hit event location in the virtual world, specified as a real 1-by-3 vector.
Data Types: double
HitOtherActorName
— Name of actor that collides with sim3d.Actor
object
character array | string
This property is read-only.
Name of actor that collides with the sim3d.Actor
object, specified as a character array or string.
BeginOverlapEvent
— Overlap begin event
0
or false
| 1
or true
This property is read-only.
Overlap begin event for sim3d.Actor
object, specified as 0
(false
) or
1
(true
).
BeginOverlapSelfID
— Identifier of overlapped sim3d.Actor
object
real positive integer
This property is read-only.
Identifier of the overlapped sim3d.Actor
object, specified as a real positive integer.
BeginOverlapOtherID
— Identifier of actor that overlaps with sim3d.Actor
object
real positive integer
This property is read-only.
Identifier of the actor that overlaps with the sim3d.Actor
object, specified as a real positive integer.
BeginOverlapOtherActorName
— Name of actor that overlaps with sim3d.Actor
object
character array | string
This property is read-only.
Name of actor that overlaps with the sim3d.Actor
object, specified as a character array or string.
EndOverlapEvent
— Overlap end event
0
or false
| 1
or true
This property is read-only.
Overlap end event for sim3d.Actor
object, specified as 0
(false
) or
1
(true
).
EndOverlapSelfID
— Identifier of sim3d.Actor
object ending overlap
real positive integer
This property is read-only.
Identifier of the sim3d.Actor
object that is ending overlap, specified as a real positive integer.
EndOverlapOtherID
— Identifier of actor that ends overlap with sim3d.Actor
object
real positive integer
This property is read-only.
Identifier of the actor that ends overlap with the sim3d.Actor
object, specified as a real positive integer.
EndOverlapOtherActorName
— Name of actor that ends overlap with sim3d.Actor
object
character array | string
This property is read-only.
Name of actor that ends overlap with the sim3d.Actor
object, specified as a character array or string.
ClickEvent
— Click event
0
or false
| 1
or true
This property is read-only.
Click event for sim3d.Actor
object, specified as 0
(false
) or
1
(true
).
ClickActorID
— Identifier of sim3d.Actor
object that is clicked
real positive integer
This property is read-only.
Identifier of the sim3d.Actor
object that is clicked, specified as a real positive integer.
ClickLocation
— Cartesian coordinates of the click event location
[0,0,0]
(default) | real 1-by-3 vector
This property is read-only.
Cartesian coordinates of the click event location in the virtual world, specified as a real 1-by-3 vector.
Data Types: double
ClickActorName
— Name of clicked actor
character array | string
This property is read-only.
Name of clicked actor, specified as a character array or string.
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 |
createMesh | Create new mesh with specified values |
addMesh | Append 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 |
Examples
Create World and Actor
This example shows how to create an actor in a virtual world to display in the Simulation 3D Viewer window using Simulink® or MATLAB®.
This process does not build an appearance for the actor, so the Simulation 3D Viewer does not render a visualization of the actor. For an example that shows how to build an appearance for an actor, see Build Actor from 3D Graphic Primitives.
Create Virtual World with Actor Using Simulink
You can use the Simulation 3D Actor block and Simulation 3D Scene Configuration block to create an actor in a virtual world and view it in the Simulation 3D Viewer window.
Open Model
Open the Simulink model.
open_system("CreateWorld");
Explore Model Components
The model includes a Simulation 3D Scene Configuration block and a Simulation 3D Actor block. The Simulation 3D Scene Configuration block implements a 3D simulation environment. Double-click the Simulation 3D Scene Configuration block to open the Block Parameters dialog box. Set a view in the scene with the Scene view parameter. You can also set a custom viewpoint with this parameter. You must include the configuration block when building Simulink models with Simulation 3D Actor blocks.
The Simulation 3D Actor block adds an actor to the virtual world. Double-click the Simulation 3D Actor block to open the Block Parameters dialog box. To create an actor before simulation starts, on the Main tab, set the Operation parameter to Create at setup
. The block first creates an empty actor with the name specified in the Actor name parameter. You can use any name for the actor. Then, the block loads the source file, if any is present, and runs the Initialization script to build an appearance for the actor. For more details, see Operating Modes. For this example, the block does not build an appearance for the actor in the virtual world.
Simulate Model
Simulate the model and view the virtual world in the Simulation 3D Viewer.
sim("CreateWorld");
Close Model
Close the Simulink model.
close_system("CreateWorld");
Create Virtual World with Actor Using MATLAB
You can use the sim3d.World
and sim3d.Actor
objects to create an actor in a virtual world and view it in the Simulation 3D Viewer window.
Create World
Create a world scene.
world = sim3d.World();
Create Actor
Add an actor to the world.
add(world,sim3d.Actor());
Run Simulation
Run a simulation set for 10
seconds with a sample time of 0.02
seconds.
run(world,0.02,10)
Delete World
Delete the world object.
delete(world);
Version History
Introduced in R2022bR2023b: Base properties
The sim3d.Actor
object has a new base property
CoordinateSystem
to represent actor orientation.
R2023b: Physical properties
The sim3d.Actor
object has these new physical properties:
Hidden
to hide actor visibility.Force
applies force to the actor.Torque
applies torque to the actor.
R2023b: Material properties
The sim3d.Actor
object has a new material property
TwoSided
to render two sides of an actor surface.
R2023a: Communicate Unreal Engine Events
Use sim3d.Actor
object properties to communicate events in the
Unreal Engine simulation 3D environment, including when:
You click an actor.
An actor collides or overlaps with another actor.
You initialize an event callback for an actor.
R2023a: Precise Contacts
Use the PreciseContacts
property to allow Unreal Engine to precisely render collisions.
R2023a: Physical properties
The sim3d.Actor
object has these new physical properties:
Friction
Restitution
Open Example
You have a modified version of this example. Do you want to open this example with your edits?
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
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)