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

Bot doesn't jump over a 2 block gap 1 block lower than it. #39

Open
GoogleSites opened this issue Jun 12, 2019 · 8 comments
Open

Bot doesn't jump over a 2 block gap 1 block lower than it. #39

GoogleSites opened this issue Jun 12, 2019 · 8 comments

Comments

@GoogleSites
Copy link

Bot keeps getting stuck in this type of scenario:

https://gyazo.com/f9f36242c761fc442da3247542517ab4

Make this and have the bot walk over it and it'll fall each time - doesn't even try to jump the gap.

@GoogleSites
Copy link
Author

GoogleSites commented Jun 13, 2019

Here's a video: https://youtu.be/TfIrl4GpYGQ

An easy way to fix this is to have the bot jump - it can make it over easily without sprinting.

@GoogleSites
Copy link
Author

Here's another path-finding issue (same type of thing):
https://gyazo.com/8ecb5c78b2d921df898fd8d7b6ff48de

@rom1504
Copy link
Member

rom1504 commented Jun 15, 2019

Indeed looks like a bug related to jumping in mineflayer.
You can try to tweak jumping in mineflayer and tweak the way it's used in mineflayer-navigate

@GoogleSites
Copy link
Author

For mineflayer-navigate, do you mean this code block?

  } else if (delta.y > -0.1) {
    // possibly jump over a hole
    gottaJump = 1.5 < horizontalDelta && horizontalDelta < 2.5;
  }
  bot.setControlState('jump', gottaJump);

@rom1504
Copy link
Member

rom1504 commented Jun 15, 2019

Yes

@rom1504
Copy link
Member

rom1504 commented Jun 15, 2019

I guess it doesn't jump for long enough

@GoogleSites
Copy link
Author

GoogleSites commented Jun 15, 2019

Kinda rough but this works. I'll clean it up later.

  if (delta.y > 0.1) {
    // gotta jump up when we're close enough
    gottaJump = horizontalDelta < 1.75;
  } else if (delta.y > -0.1) {
    // possibly jump over a hole
    gottaJump = 1.5 < horizontalDelta && horizontalDelta < 2.5;
  } else if (Math.floor(nextPoint.y) === Math.floor(currentPosition.y - 1)) {
    gottaJump = 1.5 < horizontalDelta && horizontalDelta <= 4;
  }
  bot.setControlState('jump', gottaJump);

@GoogleSites
Copy link
Author

better version:

  if (delta.y > 0.1) {
    // gotta jump up when we're close enough
    gottaJump = horizontalDelta < 1.75;
  } else if (delta.y > -0.1) {
    // possibly jump over a hole
    gottaJump = 1.5 < horizontalDelta && horizontalDelta < 2.5;
  } else if (delta.y < -0.1) {
    // possibly jump over a hole 1 block lower
    gottaJump = 3 < horizontalDelta && horizontalDelta <= 4;
  }
  bot.setControlState('jump', gottaJump);

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

2 participants