Module TelemeterUnit
Measures the distance to an obstacle in front of it.
Element class: TelemeterUnit
Extends: Element
Functions
getDistance () | Deprecated: Returns the distance to the first obstacle in front of the telemeter. |
raycast () | Emits a raycast from the telemeter, returns a raycastHit object. |
getRayOrigin () | Returns telemeter raycast origin in local construct coordinates. |
getRayWorldOrigin () | Returns telemeter raycast origin in world coordinates. |
getRayAxis () | Returns telemeter raycast axis in local construct coordinates. |
getRayWorldAxis () | Returns telemeter raycast axis in world coordinates. |
getMaxDistance () | Returns the max distance from which an obstacle can be detected (default is 100m). |
Functions
- getDistance ()
-
Deprecated: Returns the distance to the first obstacle in front of the telemeter.
This method is deprecated: raycast().distance should be used instead
Returns:
-
meter
The distance to the obstacle. Returns -1 if there are no obstacles up to getMaxDistance.
See also:
- raycast ()
-
Emits a raycast from the telemeter, returns a raycastHit object.
Returns:
-
table
A table with fields: {[bool] hit, [float] distance, [vec3] point}
- getRayOrigin ()
-
Returns telemeter raycast origin in local construct coordinates.
Returns:
-
vec3
The telemeter raycast origin.
- getRayWorldOrigin ()
-
Returns telemeter raycast origin in world coordinates.
Returns:
-
vec3
The telemeter raycast origin.
- getRayAxis ()
-
Returns telemeter raycast axis in local construct coordinates.
Returns:
-
vec3
The telemeter raycast axis.
- getRayWorldAxis ()
-
Returns telemeter raycast axis in world coordinates.
Returns:
-
vec3
The telemeter raycast axis.
- getMaxDistance ()
-
Returns the max distance from which an obstacle can be detected (default is 100m).
Returns:
-
float
The max distance to detectable obstacles in meters.