-
-
Notifications
You must be signed in to change notification settings - Fork 9
physics.Trace
Jérôme Leclercq edited this page Dec 8, 2020
·
1 revision
API: physics.Trace
Trace a ray between two positions and returns the first hit entity data.
physics.Trace
(layer: integer
, startPos: vec2
, endPos: vec2
) -> result: table
| nil
-
layer
: The layer to query. -
startPos
: The starting position of the ray. -
endPos
: The end position of the ray.
-
result
: A table containing data about the intersection (or nil if no entity was hit).
Fields:- fraction:
number
: A number ranging from 0 to 1 indicating how far the ray travelled before hitting the entity. - hitPos:
vec2
: The hit position. - hitNormal:
vec2
: The hit position. - hitEntity:
Entity
: The hit entity.
- fraction: