add block.raycast(...)
This commit is contained in:
@@ -482,6 +482,20 @@ block.set_user_bits(x: int, y: int, z: int, offset: int, bits: int, value: int)
|
||||
```
|
||||
Set specified bits.
|
||||
|
||||
```lua
|
||||
block.raycast(start: vec3, dir: vec3, max_distance: number) -> {
|
||||
block: int, -- block id
|
||||
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
|
||||
} or nil
|
||||
```
|
||||
|
||||
Casts a ray from the start point in the direction of dir. Max_distance specifies the maximum ray length.
|
||||
|
||||
The function returns a table with the results or nil if the ray does not hit any block.
|
||||
|
||||
## *item* library
|
||||
|
||||
```python
|
||||
|
||||
@@ -402,6 +402,20 @@ block.get_picking_item(id: int) -> int
|
||||
|
||||
Возвращает числовой id предмета, указанного в свойстве *picking-item*.
|
||||
|
||||
```lua
|
||||
block.raycast(start: vec3, dir: vec3, max_distance: number) -> {
|
||||
block: int, -- id блока
|
||||
endpoint: vec3, -- точка касания луча
|
||||
iendpoint: vec3, -- позиция блока, которого касается луч
|
||||
length: number, -- длина луча
|
||||
normal: vec3, -- вектор нормали поверхности, которой касается луч
|
||||
} или nil
|
||||
```
|
||||
|
||||
Бросает луч из точки start в направлении dir. Max_distance указывает максимальную длину луча.
|
||||
|
||||
Функция возвращает таблицу с результатами или nil, если луч не касается блока.
|
||||
|
||||
### Вращение
|
||||
|
||||
Следующие функции используется для учёта вращения блока при обращении к соседним блокам или других целей, где направление блока имеет решающее значение.
|
||||
|
||||
Reference in New Issue
Block a user