Instance Method

# setRotation(_:forTime:)

Sets the orientation of the transform for the specified time sample.

## Parameters

`rotation`

The orientation, as Euler angles in radians, to set for the transform relative to its parent coordinate space.

`time`

The time sample with which to associate transform information.

## Discussion

The three components of the `rotation` vector describe counterclockwise rotation around the corresponding axes. In a coordinate system where the negative z-axis direction is considered “forward”, these components are pitch (rotation about the x-axis), yaw (rotation about the y-axis), and roll (rotation about the z-axis).

Together with the translation, scale, and shear factors, rotation information defines the local coordinate space for any object affected by the transform, relative to a parent coordinate space. To work with the complete transform, use the `localTransform(atTime:)` and `setLocalTransform(_:forTime:)` methods.

Setting a new rotation synthesizes a complete transform matrix by combining the new translation with the `translation(atTime:)`, `scale(atTime:)`, and `shear(atTime:)` factors for the specified time. If the new time is outside the range of the `minimumTime` and `maximumTime` properties, this method updates those values to reflect the range of time samples stored in the transform object.

### Using Factors of an Animated Transform

`func translation(atTime: TimeInterval) -> vector_float3`

Returns the x-, y-, and z-axis offsets of the transform relative to its parent coordinate space, as of the specified time sample.

`func setTranslation(vector_float3, forTime: TimeInterval)`

Sets the x-, y-, and z-axis offsets of the transform for the specified time sample.

`func rotation(atTime: TimeInterval) -> vector_float3`

Returns the orientation of the transform relative to its parent coordinate space, as of the specified time sample.

`func rotationMatrix(atTime: TimeInterval) -> matrix_float4x4`

Returns the orientation of the transform as a rotation matrix, as of the specified time sample.

`func scale(atTime: TimeInterval) -> vector_float3`

Returns the x-, y-, and z-axis scale factors of the transform relative to its parent coordinate space, as of the specified time sample.

`func setScale(vector_float3, forTime: TimeInterval)`

Sets the x-, y-, and z-axis scale factors of the transform for the specified time sample.

`func shear(atTime: TimeInterval) -> vector_float3`

Returns the x-, y-, and z-axis shear factors of the transform relative to its parent coordinate space, as of the specified time sample.

`func setShear(vector_float3, forTime: TimeInterval)`

Sets the x-, y-, and z-axis shear factors of the transform for the specified time sample.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.