Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bedrock - Falling through partial blocks. #113

Open
irkmandeer opened this issue Nov 29, 2023 · 0 comments
Open

Bedrock - Falling through partial blocks. #113

irkmandeer opened this issue Nov 29, 2023 · 0 comments

Comments

@irkmandeer
Copy link

I'm attempting to get physics to work somewhat reliably on bedrock. There's a quirk I can seem to figure out.

When standing on a partial block, eg farmland, mud, etc, and the block gets converted into a solid block, eg. dirt or clay, the bot falls thought the block.

What is the the difference between how BBs are handled Java and Bedrock?

I have added a temporary hack in moveEntity() to prevent this from happening:

...

if (dy != 0 && entity.onGround) {
for (const blockBB of surroundingBBs) {
  dy = blockBB.computeOffsetY(playerBB, dy)
}

if (dy != 0 && entity.onGround) {

  const block = world.getBlock(pos)

  for (const shape of block.shapes) {

    const BB = new AABB(shape[0], shape[1], shape[2], shape[3], shape[4], shape[5])
    BB.offset(block.position.x, block.position.y, block.position.z)

    console.log(JSON.stringify(shape), playerBB.intersects(BB))

    if (playerBB.intersects(BB)) {

      dy = Math.abs(block.position.y - pos.y)
      break
    }
  }
}

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant