One Logo Pool Ball
RealityFoundation · IOS API REFERENCE

CollisionCastHit

struct · iOS 13.0+ · SDK 27.1

struct CollisionCastHit

A hit result of a collision cast. You get a collection of collision cast hits from either the ``Scene/raycast(origin:direction:length:query:mask:relativeTo:)`` method, or the ``Scene/convexCast(convexShape:fromPosition:fromOrientation:toPosition:toOrientation:query:mask:relativeTo:)`` method. Each hit indicates where the ray or the convex shape, starting at a given point and traveling in a given direction, hit a particular entity in the scene. The frame of reference for the position and normal of the hit depends on the reference entity parameter passed to the method that generated the hit. Pass `nil` as the reference to use world space.

Members (6)

get · iOS 18.0+

triangleHit

TypeScript
get triangleHit(): (CollisionCastHit_TriangleHit) | null
Swift declaration
var triangleHit: CollisionCastHit.TriangleHit? { get }

Information the system provides when a ray touches or intersects a triangle mesh.

get · iOS 18.0+

shapeIndex

TypeScript
get shapeIndex(): number
Swift declaration
var shapeIndex: Int { get }

The index of the shape that was hit.

get · iOS 13.0+

entity

TypeScript
get entity(): Entity
Swift declaration
var entity: Entity { get }

The entity that was hit.

get · iOS 13.0+

normal

TypeScript
get normal(): SDKHandle
Swift declaration
var normal: SIMD3<Float> { get }

The normal of the hit. The frame of reference for this point depends on the reference entity used in the call to either the ``Scene/raycast(origin:direction:length:query:mask:relativeTo:)`` method or the ``Scene/convexCast(convexShape:fromPosition:fromOrientation:toPosition:toOrientation:query:mask:relativeTo:)`` method that generated the hit.

get · iOS 13.0+

distance

TypeScript
get distance(): number
Swift declaration
var distance: Float { get }

The distance from the ray origin to the hit, or the convex shape travel distance.

get · iOS 13.0+

position

TypeScript
get position(): SDKHandle
Swift declaration
var position: SIMD3<Float> { get }

The position of the hit. The frame of reference for this point depends on the reference entity used in the call to either the ``Scene/raycast(origin:direction:length:query:mask:relativeTo:)`` method or the ``Scene/convexCast(convexShape:fromPosition:fromOrientation:toPosition:toOrientation:query:mask:relativeTo:)`` method that generated the hit.

Skipped declarations

No declarations were skipped in this snapshot.

All RealityFoundation types →