You are here: Lua Scripting Resources eGuide > Lua Scripting API Reference Guide > Physics Library > segmentQueryFirst

19.13.4 segmentQueryFirst

info = physics.Space:segmentQueryFirst(startvect,  stopvect,layers, group)

Parameter

Type

Description

self

in physics.Shape

The input Shape

startvect

in physics.Vect

An end point of the segment

stopvect

in physics.Vect

Other end point of the segment

layers

in number

A bitmap of the layers.
Match if shape.layers inter- sects layers

group

in number

The group number to check.
Match if object is not in group

info

out physics.SegmentQueryInfo

Information about where the segment and Shape intersect. Nil if no intersection

Queries Space along the line segment from startvect to stopvect and returns the first intersecting Shape that matches layers and not in group. Returns a SegmentQueryInfo object with the first Shape that matches the query or nil if no intersection.

Introduced in platform.apiLevel = '2.0'