unreal.GeometryScript_Ray

class unreal.GeometryScript_Ray(outer: Object | None = None, name: Name | str = 'None')

Bases: BlueprintFunctionLibrary

Geometry Script Library Ray Functions

C++ Source:

  • Plugin: GeometryScripting

  • Module: GeometryScriptingCore

  • File: ShapeFunctions.h

classmethod get_ray_box_intersection(ray, box) double or None

Check if the Ray intersects a Sphere defined by the SphereCenter and SphereRadius.

Parameters:
Returns:

true if the ray hits the box, and false otherwise

hit_distance (double): Distance along the ray (Ray Parameter) to first intersection point with the Box

Return type:

double or None

classmethod get_ray_closest_point(ray, point) Vector

Get the closest point on the Ray to the given Point

Parameters:
Return type:

Vector

classmethod get_ray_line_closest_point(ray, line_origin, line_direction) -> (double, ray_parameter=double, ray_point=Vector, line_parameter=double, line_point=Vector)

Compute the pair of closest points on a 3D Ray and Line. The Line is defined by an Origin and Direction (ie same as a Ray) but extends infinitely in both directions.

Parameters:
Returns:

the minimum distance between the Ray and Line, ie between RayPoint and LinePoint

ray_parameter (double): the Ray Parameter of the closest point on the Ray (range 0, inf)

ray_point (Vector): the point on the Ray corresponding to RayParameter

line_parameter (double): the Line parameter of the closest point on the Line (range -inf, inf)

line_point (Vector): the point on the Line corresponding to LineParameter

Return type:

tuple

classmethod get_ray_parameter(ray, point) double

Project the given Point onto the closest point along the Ray, and return the Ray Parameter/Distance at that Point

Parameters:
Return type:

double

classmethod get_ray_plane_intersection(ray, plane) double or None

Find the intersection of a Ray and a Plane

Parameters:
Returns:

true if the ray hits the plane (only false if ray is parallel with plane)

hit_distance (double): the returned Distance along the ray (Ray Parameter) to intersection point with the Plane

Return type:

double or None

classmethod get_ray_point(ray, distance) Vector

Get a Point at the given Distance along the Ray (Origin + Distance*Direction)

Parameters:
  • ray (Ray) –

  • distance (double) –

Return type:

Vector

classmethod get_ray_point_distance(ray, point) double

Get the distance from Point to the closest point on the Ray

Parameters:
Return type:

double

classmethod get_ray_segment_closest_point(ray, seg_start_point, seg_end_point) -> (double, ray_parameter=double, ray_point=Vector, seg_point=Vector)

Compute the pair of closest points on a 3D Ray and Line Segment The Line Segment is defined by its two Endpoints.

Parameters:
Returns:

the minimum distance between the Ray and Segment, ie between RayPoint and SegPoint

ray_parameter (double): the Ray Parameter of the closest point on the Ray (range 0, inf)

ray_point (Vector): the point on the Ray corresponding to RayParameter

seg_point (Vector): the point on the Segment

Return type:

tuple

classmethod get_ray_sphere_intersection(ray, sphere_center, sphere_radius) (distance1=double, distance2=double) or None

Check if the Ray intersects a Sphere defined by the SphereCenter and SphereRadius. This function returns two intersection distances (ray parameters). If the ray grazes the sphere, both distances will be the same, and if it misses, they will be MAX_FLOAT. Use the function GetRayPoint to convert the distances to points on the ray/sphere.

Parameters:
  • ray (Ray) –

  • sphere_center (Vector) –

  • sphere_radius (double) –

Returns:

true if ray intersects sphere

distance1 (double): Distance along ray (Ray Parameter) to first/closer intersection point with sphere

distance2 (double): Distance along ray (Ray Parameter) to second/further intersection point with sphere

Return type:

tuple or None

classmethod get_ray_start_end(ray, start_distance=0.000000, end_distance=0.000000) -> (start_point=Vector, end_point=Vector)

Get two points along the ray.

Parameters:
  • ray (Ray) –

  • start_distance (double) –

  • end_distance (double) –

Returns:

start_point (Vector): returned as Origin + StartDistance*Direction

end_point (Vector): returned as Origin + EndDistance*Direction, Unless EndDistance = 0, then MaxFloat is used as the Distance

Return type:

tuple

classmethod get_transformed_ray(ray, transform, invert=False) Ray

Apply the given Transform to the given Ray, or optionally the Transform Inverse, and return the new transformed Ray

Parameters:
Return type:

Ray

classmethod make_ray_from_point_direction(origin, direction, direction_is_normalized=True) Ray

Create a Ray from an Origin and Direction, with optionally non-normalized Direction

Parameters:
Return type:

Ray

classmethod make_ray_from_points(a, b) Ray

Create a Ray from two points, placing the Origin at A and the Direction as Normalize(B-A)

Parameters:
Return type:

Ray