mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 00:33:59 +00:00
Player: Do direction checks for interaction in 3D instead of 2D
This fixes #983, but I haven't yet tested if this will prevent cheating in an actual hacker scenario. Needs more tests. Additionally, this should remove the need for the negative threshold - if the diff is less than 0, the player is almost definitely cheating.
This commit is contained in:
parent
0688a86f57
commit
a8bf2191b9
@ -1753,10 +1753,10 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
return false;
|
||||
}
|
||||
|
||||
$dV = $this->getDirectionPlane();
|
||||
$dot = $dV->dot(new Vector2($eyePos->x, $eyePos->z));
|
||||
$dot1 = $dV->dot(new Vector2($pos->x, $pos->z));
|
||||
return ($dot1 - $dot) >= -$maxDiff;
|
||||
$dV = $this->getDirectionVector();
|
||||
$eyeDot = $dV->dot($eyePos);
|
||||
$targetDot = $dV->dot($pos);
|
||||
return ($targetDot - $eyeDot) >= -$maxDiff;
|
||||
}
|
||||
|
||||
protected function initHumanData(){
|
||||
|
Loading…
x
Reference in New Issue
Block a user