Raycast

Perform intersection tests against a bundle of obstacle prims. The intersection test can be a raycast or a sweep operation, and the source of the test can be a prim from a bundle or a point and direction. If ‘Source Type’ is ‘Point and Direction’ and ‘Query Type’ is ‘Raycast’, then a ray is created from the input point and direction and cast against the meshes in the obstacles bundle. If ‘Source Type’ is ‘Point and Direction’ and ‘Query Type’ is ‘Sweep’, then a sphere with ‘radius’ is swept out from the input point and direction If ‘Source Type’ is ‘Bundle Prim’ and ‘Query Type’ is ‘Raycast’, then for each prim in the input bundle a ray is generated from the origin and z-axis of the prim transformed into world space. If ‘Source Type’ is ‘Bundle Prim’ and ‘Query Type’ is ‘Sweep’, then for each mesh prim in the input bundle a bounding sphere is fit to the prim’s points and that sphere is used for the sweep.

Installation

To use this Node, you must enable omni.genproc.core in the Extension Manager.

Inputs

Name

Type

Description

Default

Prim in Bundle (primBundle)

bundle

Bundle containing prim data for use in raycast / sweep (when ‘Bundle Prim’ is specified as the source type)

Point (point)

float[3]

Origin of raycast (when ‘Point and Direction’ is specified as the source type)

[0, 0, 0]

Direction (direction)

float[3]

Direction of raycast. When ‘Point and Direction’ is specified as the source type, this direction is used in world space. When ‘Bundle Prim’ is the source type, this direction is considered to be in the prim’s local space (in other words, the prim’s transform is applied to this direction before the raycast).

[0, 0, 1]

Source Type (sourceType)

int

0 = bundle prim, 1 = point and direction

0

Query Type (queryType)

int

0 = raycast, 1 = sweep

0

Range (range)

float

If positive, this value specifies the maximum distance considered for intersection tests. otherwise ‘infinite’ distance is used for intersection tests.

0.0

Closest Hit Only (closestHitOnly)

bool

If true, only the closest hit will be reported. Otherwise multiple ray intersections may be returned. (Note that this value only matters for raycast queries. Sweep queries will never return more than one hit.)

True

Radius (radius)

float

Radius of sphere used in sweep query (when ‘Point and Direction’ is specified as the source type)

1.0

Verbose (verbose)

bool

Print intersection information.

False

obstacleBundle

bundle

Bundle containing intersection geometry for raycasting / sweeping

Outputs

Name

Type

Description

Default

Points (points)

float[3][]

One or more (in the case of raycasting from multiple source prims or with closestHitOnly enabled) intersection points.

Normals (normals)

float[3][]

Surface normals of intersection points

Face Indices (faceIndices)

int[]

Face indices of intersection points

Distances (distances)

float[]

Distances to intersection points

Paths (paths)

token[]

Paths to prims hit by raycast / sweep