Contenuto principale

Actor Transformations in Simulink 3D Animation

R2026b

You can position and orient actors in the 3D environment using translation and rotation values. This topic explains how the software applies transformations to an actor and how those transformations propagate through parent-child hierarchy.

When you add an actor to the 3D environment, by default, the actor follows the Simulink® 3D Animation™ coordinate system. You can also set the coordinate system for each actor. For more details on the different coordinate systems, see Coordinate Systems in Simulink 3D Animation. If you set an actor as a child of another actor, set the child actor coordinate system to match the parent actor coordinate system.

Transformations

You can specify these actor transformations:

  • Translation specifies the actor position relative to the parent actor. For sim3d actor objects, use the Translation property. For Simulation 3D blocks, use the Translation parameter.

  • Rotation specifies the actor orientation using Euler angles, applied relative to the parent actor. For sim3d actor objects, use the Rotation property. For Simulation 3D blocks, use the Rotation parameter.

  • Scale specifies the actor size along the X-axis, Y-axis, and Z-axis relative to the parent actor. For sim3d actor objects, use the Scale property. For Simulation 3D blocks, use the Scale parameter.

If you attach an actor as child actor to a parent actor, then the transformations on the child actor apply relative to the parent actor.

Rotation Order

When you set the rotation of an actor in the 3D environment, the order in which the actor rotates affects the resulting orientation. Simulink 3D Animation applies extrinsic rotation in the order:

  1. Rotate about X-axis (roll)

  2. Rotate about Y-axis (pitch)

  3. Rotate about Z-axis (yaw)

When you update any of the three rotation values and leave others unchanged, the software reapplies all three rotations in the same order.

The animation illustrates the rotation order relative to the parent axes of the actor and displays:

  • The global fixed coordinate system frame, which is the Simulink 3D Animation coordinate system.

  • The X-axis is represented in red, Y-axis in green, and Z-axis in blue.

  • Box actor with its coordinate system frame.

  • The actor changes color to match the axis of the active rotation step.

The table summarizes the box actor property values for animation.

PropertyValue
Rotation[45 60 40] deg
CoordinateSystem'Default'

Quaternion Rotation Representation

Quaternions provide a reliable way to combine rotations. The software adjusts Euler-angle values to maintain a valid orientation representation when the pitch value is in the range less than –90 deg or more than 90 deg.

The Euler angles are converted to quaternions internally and then converted back to Euler angles. Therefore, when you query the rotation value, the Euler angles can differ from the values you entered. As a result, the Euler values shown in the Actor Editor of the Simulation 3D Viewer interface or in the output port of the Simulation 3D Actor block might differ from the values you entered, while still representing the same orientation.

Parent-Child Rotation Propagation

In the actor hierarchy, each child actor inherits the transformations of its parent. The Translation, Rotation, and Scale of the child actor is relative to the parent actor. How rotations combine depends on the coordinate systems that the parent and child use.

Default Coordinate System

The animation illustrates the parent-child rotation propagation using two box actors. The bigger box actor is set as the parent of the smaller box actor. The parent rotates relative to the global fixed coordinate system, which is the default for Simulink 3D Animation, and the child rotates relative to the parent axes.

The table summarizes the parent and child actor property values for animation using the default coordinate system.

TypePropertyValue
ParentRotation[0 45 0] deg
CoordinateSystem'Default'
ChildRotation[0 0 45] deg
CoordinateSystem'Default'

SAE Coordinate System

The table summarizes the parent and child actor property values for animation using the SAE coordinate system.

TypePropertyValue
ParentRotation[0 40 0] deg
CoordinateSystem'SAE'
ChildRotation[0 0 60] deg
CoordinateSystem'SAE'

See Also

|

Topics