<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/Scene/convexCast(convexShape:fromPosition:fromOrientation:toPosition:toOrientation:query:mask:relativeTo:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation5SceneC10convexCast0D5Shape12fromPosition0G11Orientation02toH00jI05query4mask10relativeToSayAA09CollisionE3HitVGAA0F8ResourceC_s5SIMD3VySfGSo10simd_quatfaAtvA0oE9QueryTypeOAA0O5GroupVAA6EntityCSgtF"
  },
  "title" : "convexCast(convexShape:fromPosition:fromOrientation:toPosition:toOrientation:query:mask:relativeTo:)"
}
-->

# convexCast(convexShape:fromPosition:fromOrientation:toPosition:toOrientation:query:mask:relativeTo:)

Performs a convex shape cast against all the geometry in the scene.

```
@MainActor @preconcurrency func convexCast(convexShape: ShapeResource, fromPosition: SIMD3<Float>, fromOrientation: simd_quatf, toPosition: SIMD3<Float>, toOrientation: simd_quatf, query: CollisionCastQueryType = .all, mask: CollisionGroup = .all, relativeTo referenceEntity: Entity? = nil) -> [CollisionCastHit]
```

## Parameters

`convexShape`

The convex shape to cast.

`fromPosition`

The starting position of `convexShape` relative to
`referenceEntity`.

`fromOrientation`

The starting orientation of `convexShape` relative to
`referenceEntity`.

`toPosition`

The ending position of `convexShape` relative to
`referenceEntity`.

`toOrientation`

The ending orientation of `convexShape` relative to
`referenceEntity`.

`query`

The query type.

`mask`

A collision mask that you can use to prevent collisions with
certain objects.

`referenceEntity`

An entity that defines the frame of reference. The
method returns results relative to this entity. Set to `nil` to use the
world space origin `(0, 0, 0)`.

## Return Value

An array of collision cast hit results. Each hit indicates
where the convex shape, starting at a given point and traveling in a
given direction, collides with entities in the scene. To retrieve the
hit entity from a returned [`CollisionCastHit`](/documentation/RealityKit/CollisionCastHit), use the
[`entity`](/documentation/RealityKit/CollisionCastHit/entity) property.

## Discussion

For objects that intersect the convex shape at its starting position and
orientation, the returned collision cast hit result’s
[`position`](/documentation/RealityKit/CollisionCastHit/position) is `(0, 0, 0)` and the
[`normal`](/documentation/RealityKit/CollisionCastHit/normal) points in the opposite direction of the
sweep.

---

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)