Difference between revisions of "Shape:rayCast"

(Added Shape:rayCast.)
 
(Argh, making too many mistakes.)
Line 24: Line 24:
 
== See Also ==
 
== See Also ==
 
* [[parent::Shape]]
 
* [[parent::Shape]]
[[Category:Shape]]
+
[[Category:Functions]]
 
{{#set:Description=Casts a ray against the shape.}}
 
{{#set:Description=Casts a ray against the shape.}}
 
{{#set:Since=080}}
 
{{#set:Since=080}}
 
== Other Languages ==
 
== Other Languages ==
 
{{i18n|Shape:rayCast}}
 
{{i18n|Shape:rayCast}}

Revision as of 11:42, 4 May 2012

Available since LÖVE 0.8.0
This method is not supported in earlier versions.

Casts a ray against the shape. The Shape can be transformed to get it into the desired position.

Function

Synopsis

x, y, fraction = Shape:rayCast( x1, y1, x2, y2, maxFraction, tx, ty, tr, childIndex )

Arguments

number x1
The x position of the ray starting point.
number y1
The y position of the ray starting point.
number x2
The x position of the ray end point.
number y1
The y position of the ray end point.
number maxFraction
The maximum distance the ray is going to travel as a number from 0 to 1.
number tx
The translation of the shape on the x-axis.
number ty
The translation of the shape on the y-axis.
number tr
The shape rotation.
number childIndex (1)
The index of the child the ray gets cast against.

Returns

number x
The x position where the ray intersects with the shape.
number y
The y position where the ray intersects with the shape.
number fraction
The position on the input vector where the intersection happened as a number from 0 to 1.

See Also


Other Languages