<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: -",
    "macOS: 26.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 26.0.0 -",
    "watchOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Spatial",
  "identifier" : "/documentation/Spatial/Ray3DFloat/rotated(by:)-3vmkj",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Spatial"
    ],
    "preciseIdentifier" : "s:So12SPRay3DFloata7SpatialE7rotated2byABSo10simd_quatfa_tF"
  },
  "title" : "rotated(by:)"
}
-->

# rotated(by:)

Returns a ray that’s rotated by the specified quaternion.

```
func rotated(by quaternion: simd_quatf) -> Ray3DFloat
```

## Parameters

`quaternion`

The quaternion that defines the rotation.

## Discussion

- Returns A ray with a direction that’s rotated by the specified quaternion.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)