struct

CP::SegmentQueryInfo

Inherits Struct / Value / Object

Segment queries return more information than just a simple yes or no, they also return where a shape was hit and its surface normal at the hit point. This object holds that information.

Segment queries are like ray casting, but because not all spatial indexes allow processing infinitely long ray queries it is limited to segments. In practice this is still very fast and you don't need to worry too much about the performance as long as you aren't using extremely long segments for your queries.

Constructors

new(shape : Shape, point : Vect, normal : Vect, alpha : Float64)
Source

Instance methods

alpha

The normalized distance along the query segment in the range [0, 1].

Source
alpha=(alpha : Float64)
Source
normal

The normal of the surface hit.

Source
normal=(normal : Vect)
Source
point

The point of impact.

Source
point=(point : Vect)
Source
shape

The shape that was hit.

Source
shape=(shape : Shape)
Source