World:rayCastAny
Available since LÖVE 12.0 |
This method is not supported in earlier versions. |
Casts a ray and returns an intersection point if the ray touched any Shape in the world.
This will not always return the closest intersection point, use World:rayCastClosest or World:rayCast if that's desired. World:rayCastAny is more efficient than World:rayCastClosest.
Function
Synopsis
shape, x, y, xn, yn, fraction = World:rayCastAny( x1, y1, x2, y2, categoryMaskBits )
Arguments
number x1
- The x position of the starting point of the ray.
number y1
- The y position of the starting point of the ray.
number x2
- The x position of the end point of the ray.
number y2
- The y position of the end point of the ray.
number categoryMaskBits (0xFFFF)
- A bit-mask of categories the raycast can intersect with. Shapes with no categories that match any of this mask's bits will be ignored. This uses the same bit mask format as Shape:setFilterData. The default value intersects with all Shapes.
Returns
Shape shape
- The Shape intersecting the ray, or nil if there was no intersection.
number x
- The x position of the intersection point, or nil if there was no intersection.
number y
- The y position of the intersection point, or nil if there was no intersection.
number xn
- The x value of the surface normal vector of the shape edge, or nil if there was no intersection.
number yn
- The y value of the surface normal vector of the shape edge, or nil if there was no intersection.
number fraction
- The position of the intersection on the ray as a number from 0 to 1, or nil if there was no intersection.
See Also
Other Languages
Dansk –
Deutsch –
English –
Español –
Français –
Indonesia –
Italiano –
Lietuviškai –
Magyar –
Nederlands –
Polski –
Português –
Română –
Slovenský –
Suomi –
Svenska –
Türkçe –
Česky –
Ελληνικά –
Български –
Русский –
Српски –
Українська –
עברית –
ไทย –
日本語 –
正體中文 –
简体中文 –
Tiếng Việt –
한국어
More info