block.raycast/entity.raycast: Updated docs to reflect changes
This commit is contained in:
parent
1be50c2e06
commit
a48d54aa27
@ -120,12 +120,17 @@ block.raycast(start: vec3, dir: vec3, max_distance: number, [optional] dest: tab
|
||||
endpoint: vec3, -- point of the ray hit point
|
||||
iendpoint: vec3, -- position of the block hit by the ray
|
||||
length: number, -- ray length
|
||||
normal: vec3 -- normal vector of the surface hit by the ray
|
||||
normal: vec3, -- normal vector of the surface hit by the ray
|
||||
[optional] dest: table, -- table where result will be written to instead of function return
|
||||
[optional] filter: table -- list of block names that are "transparent" for ray
|
||||
} or nil
|
||||
```
|
||||
|
||||
Casts a ray from the start point in the direction of *dir*. Max_distance specifies the maximum ray length.
|
||||
|
||||
Argument `filter` can be used to tell ray what blocks can be skipped(passed through) during ray-casting.
|
||||
To use filter `dest` argument must be filled with some value(can be nil), it's done for backwards compatability
|
||||
|
||||
The function returns a table with the results or nil if the ray does not hit any block.
|
||||
|
||||
The result will use the destination table instead of creating a new one if the optional argument specified.
|
||||
|
||||
@ -51,7 +51,7 @@ entities.get_all_in_radius(center: vec3, radius: number) -> array<int>
|
||||
|
||||
```lua
|
||||
entities.raycast(start: vec3, dir: vec3, max_distance: number,
|
||||
ignore: int, [optional] destination: table) -> table or nil
|
||||
ignore: int, [optional] destination: table, [optional] filter: table) -> table or nil
|
||||
```
|
||||
|
||||
The function is an extended version of [block.raycast](libblock.md#raycast). Returns a table with the results if the ray touches a block or entity.
|
||||
|
||||
@ -65,12 +65,17 @@ block.raycast(start: vec3, dir: vec3, max_distance: number, [опциональ
|
||||
endpoint: vec3, -- точка касания луча
|
||||
iendpoint: vec3, -- позиция блока, которого касается луч
|
||||
length: number, -- длина луча
|
||||
normal: vec3 -- вектор нормали поверхности, которой касается луч
|
||||
normal: vec3, -- вектор нормали поверхности, которой касается луч
|
||||
[optional] dest: table, -- таблица куда будет записан результат вместо возврата из функции
|
||||
[optional] filter: table -- массив имён блоков которые "прозрачны" для луча
|
||||
} или nil
|
||||
```
|
||||
|
||||
Бросает луч из точки start в направлении dir. Max_distance указывает максимальную длину луча.
|
||||
|
||||
Аргумент `filter` позволяет указать какие блоки являются "прозрачными" для луча, прим.: {"base:glass","base:water"}.
|
||||
Для использования агрумент `dest` нужно чем-то заполнить(можно nil), это сделано для обратной совместимости
|
||||
|
||||
Функция возвращает таблицу с результатами или nil, если луч не касается блока.
|
||||
|
||||
Для результата будет использоваться целевая (dest) таблица вместо создания новой, если указан опциональный аргумент.
|
||||
|
||||
@ -51,7 +51,7 @@ entities.get_all_in_radius(center: vec3, radius: number) -> array<int>
|
||||
|
||||
```lua
|
||||
entities.raycast(start: vec3, dir: vec3, max_distance: number,
|
||||
ignore: int, [optional] destination: table) -> table или nil
|
||||
ignore: int, [optional] destination: table, [optional] filter: table) -> table или nil
|
||||
```
|
||||
|
||||
Функция является расширенным вариантом [block.raycast](libblock.md#raycast). Возвращает таблицу с результатами если луч касается блока, либо сущности.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user