PocketMine-MP 5.21.3 git-fcef015f32c0b0709cfd4d6f1b3c32f484b25bde
|
Static Public Member Functions | |
static | betweenPoints (Vector3 $start, Vector3 $end) |
static | inDirection (Vector3 $start, Vector3 $directionVector, float $maxDistance) |
Definition at line 29 of file VoxelRayTrace.php.
Performs a ray trace between the start and end coordinates. This returns a Generator which yields Vector3s containing the coordinates of voxels it passes through.
The first Vector3 is $start->floor()
. Every subsequent Vector3 has a taxicab distance of exactly 1 from the previous Vector3; if the ray crosses the intersection of multiple axis boundaries directly, the algorithm prefers crossing the boundaries in the order Z -> Y -> X
.
If $end
is on an axis boundary, the final Vector3 may or may not cross that boundary. Otherwise, the final Vector3 is equal to $end->floor()
.
This is an implementation of the algorithm described in the link below. |Vector3[] -return <int, Vector3, void, void> if $start and $end have zero distance.
Definition at line 67 of file VoxelRayTrace.php.
|
static |
Performs a ray trace from the start position in the given direction, for a distance of $maxDistance. This returns a Generator which yields Vector3s containing the coordinates of voxels it passes through.
Definition at line 43 of file VoxelRayTrace.php.