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

Gravity doesn't work properly #2

Closed
woder opened this issue Aug 24, 2013 · 5 comments
Closed

Gravity doesn't work properly #2

woder opened this issue Aug 24, 2013 · 5 comments
Labels

Comments

@woder
Copy link
Owner

woder commented Aug 24, 2013

It bugs him out quite badly

@woder
Copy link
Owner Author

woder commented Sep 26, 2014

Waiting on mcp as of now to fix this.

@nuvasuper
Copy link
Collaborator

Could you explain what mcp is? Is this impossible to fix without it?

@woder
Copy link
Owner Author

woder commented Nov 24, 2014

Minecraft coder pack, I believe this is possible to fix without - just that I have no idea how gravity works so if you know how that works you can go ahead an implement it. Its in the movement handler I believe.

@nuvasuper
Copy link
Collaborator

We need to move more smoothly than currently for gravity to work. As far as I can tell, we are currently warping 1 block at a time, just at a slow enough pace so that the server treats it as a lagged connection which is moving at the normal rate. Under those conditions, I don't think it is possible to have functional gravity. In order to make gravity work, I think we'd need to set a goal-position, potentially 1 Tile at a time, and each tick have the bot move a set distance (4.317 blocks/second, or 0.21585 blocks/tick) closer to the goal-position until it reaches it. It might help to round this figure so that we reach each goal position in an integer number of ticks. This of course, would depend if we are walking diagonally (+-1, +-1) or along an axis (+-1,0) or (0,+-1).

If we changed the movement code to reflect this, we could then implement applyGravity() on each tick with an acceleration of (0.08 blocks/tick) with a drag of (0.02*velocity blocks/tick) afterwards.

I found these numbers on the minecraft wiki at http://minecraft.gamepedia.com/Gravity#Motion_of_entities
and http://minecraft.gamepedia.com/The_Player#Movement

@woder
Copy link
Owner Author

woder commented Mar 3, 2015

This is now functional, acceleration still isn't perfect but it works.

@woder woder closed this as completed Mar 3, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants