PocketMine-MP icon indicating copy to clipboard operation
PocketMine-MP copied to clipboard

Placing blocks in x coordinate is weird once a player stands close to a block and being in far coords

Open ItsZodiaX opened this issue 2 years ago • 3 comments

Issue description

  • Expected result: Block placed
  • Actual result: Block flickering and doesn't get placed

Steps to reproduce the issue

  1. Stand closer to a block
  2. Place a new block in x coordinate next to the previous block (Left, Right, Up)

OS and versions

  • PocketMine-MP: 4.2.9 (git hash: 1d314ad4cef2a0f505a22f86ca29e26463b606da)
  • PHP: 8.0.17
  • Using JIT: no
  • Server OS: Win11
  • Game version: Win10

Plugins

Plugins (1): MultiWorld v1.7.0-beta2

  • If you remove all plugins, does the issue still occur? Yes

Crashdump, backtrace or other files

https://cdn.discordapp.com/attachments/878545340058468412/966010061455495248/2022-04-19_23-15-25_Trim.mp4 https://cdn.discordapp.com/attachments/878545340058468412/966012951163207730/2022-04-19_23-29-28_Trim.mp4

ItsZodiaX avatar Apr 19 '22 16:04 ItsZodiaX

This is caused by floating-point errors. It appears the tolerance for these during collision checking is too small.

dktapps avatar May 21 '22 18:05 dktapps

Sample data:

Player:

array(1) {
  [0]=>
  object(pocketmine\math\AxisAlignedBB)#29534 (6) {
    ["minX"]=>
    float(9653.4002)
    ["minY"]=>
    float(64)
    ["minZ"]=>
    float(460.7251)
    ["maxX"]=>
    float(9654.000199999999)
    ["maxY"]=>
    float(65.8)
    ["maxZ"]=>
    float(461.3251)
  }
}

Block:

object(pocketmine\math\AxisAlignedBB)#126980 (6) {
  ["minX"]=>
  float(9654)
  ["minY"]=>
  float(64)
  ["minZ"]=>
  float(461)
  ["maxX"]=>
  float(9655)
  ["maxY"]=>
  float(65)
  ["maxZ"]=>
  float(462)
}

dktapps avatar May 21 '22 18:05 dktapps

Can we do anything about this error?

ItsZodiaX avatar May 21 '22 19:05 ItsZodiaX