struct CP::SegmentQueryInfo

Overview

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.

Defined in:

chipmunk/query.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(shape : Shape, point : Vect, normal : Vect, alpha : Float64) #

[View source]

Instance Method Detail

def alpha : Float64 #

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


[View source]
def alpha=(alpha : Float64) #

[View source]
def normal : Vect #

The normal of the surface hit.


[View source]
def normal=(normal : Vect) #

[View source]
def point : Vect #

The point of impact.


[View source]
def point=(point : Vect) #

[View source]
def shape : Shape #

The shape that was hit.


[View source]
def shape=(shape : Shape) #

[View source]