Realistic Earth Border Wrapping
Twelve0001 opened this issue ยท 15 comments
On an Earth map, going to the Max Z would bring you straight to antarctica; not very realistic.
Very easy to fix. Add an option called "Realistic Earth Border Wrapping."
Math for this would be pretty simple, its simply:
} else if (location.getZ() <= minZ) {
location.setZ(location.getZ() - 3); // so you dont fall off into the void
location.setX(location.getX() * -1); //yeah thats literally it
} else if (location.getZ() >= maxZ) {
location.setZ(location.getZ() + 3); // so you dont fall off into the void
location.setX((location.getX()) * -1); //yeah thats literally it
}
yeah, literally just multiple the X coordinate by -1. that's it.
i already tried doing it myself, but i dont really have experience with plug-ins.
I'm just trying to understand, is this the same or different than #39?
Looks like you are wrapping the X axis, which that issue suggests adding support for both directions (X and Z).
If that's not the case, would you be able to explain more how you would like this to wrap (maybe with a picture of the world)?
Thanks!
so if i walked into the red circle where my cursor is, i would be tped from 1000 to -1000. (getX * -1)
I'm just trying to understand, is this the same or different than #39?
Looks like you are wrapping the X axis, which that issue suggests adding support for both directions (X and Z).
If that's not the case, would you be able to explain more how you would like this to wrap (maybe with a picture of the world)?
Thanks!
This is different, ill see if i can explain it better.
currently, if i walked into the world border with wrapping on the +Z axis, i would be tped from (getZ) to (minZ). in an earth map, realisticly, (because, yknow, earth is a globe), you wouldn't be tped from Greenland to Antarctica
Oh gotcha. So this would basically be a separate "Earth" wrap setting.
Seems like this is also a similar idea to UV mapping (you basically want the teleport to follow the UV axes rather than XZ).
Oh gotcha. So this would basically be a separate "Earth" wrap setting.
Seems like this is also a similar idea to UV mapping (you basically want the teleport to follow the UV axes rather than XZ).
mhm, as far as i know you just multiply by -1
Sounds good. I'll look at implementing this along with #39 when I find the time (which should be sooner rather than later, I have had other features prioritized until now + just being busy).
Thanks again for the suggestion!
I managed to make it myself (although not modular). Result is pretty epic.
j4958QCL.1.mp4
Neat!
Just as a heads-up, I think the way I want to handle the config for this is to change wrap from being a boolean (true/false) to an enum (x/z/both/radial/world or something like that?). That way the user can easily select between wrap types.
Feel free to make a PR for this yourself if you want, but if not, I can take care of this for you when I get to it.
All good. ๐ I think I should have time for this this weekend (+ generally want to get through the issue backlog here).
i did the math very wrong, this is what it actually should be:
if (location.getX() <= minX) {
location.setX(maxX - 2);
} else if (location.getX() >= maxX) {
location.setX(minX + 2);
} else if (location.getZ() <= minZ) {
if (location.getX() >= 0) {
location.setZ(location.getZ() + 2);
location.setX(location.getX() - maxX);
location.setYaw(location.getYaw() + 180);
} else {
location.setZ(location.getZ() + 2);
location.setX(location.getX() + maxX);
location.setYaw(location.getYaw() + 180);
}
} else if (location.getZ() >= maxZ) {
if (location.getX() >= 0) {
location.setZ(location.getZ() - 2);
location.setX(location.getX() - maxX);
location.setYaw(location.getYaw() + 180);
} else {
location.setZ(location.getZ() - 2);
location.setX(location.getX() + maxX);
location.setYaw(location.getYaw() + 180);
}
}
Neat!
to
Just as a heads-up, I think the way I want to handle the config for this is to change wrap from being a boolean (true/false) to an enum (x/z/both/radial/world or something like that?). That way the user can easily select between wrap types.Feel free to make a PR for this yourself if you want, but if not, I can take care of this for you when I get to it.
im not a plugin developer, i pretty much only do stuff with fabric. I'm not certain how adding config options work.
i did the math very wrong, this is what it actually should be:
if (location.getX() <= minX) { location.setX(maxX - 2); } else if (location.getX() >= maxX) { location.setX(minX + 2); } else if (location.getZ() <= minZ) { if (location.getX() >= 0) { location.setZ(location.getZ() + 2); location.setX(location.getX() - maxX); location.setYaw(location.getYaw() + 180); } else { location.setZ(location.getZ() + 2); location.setX(location.getX() + maxX); location.setYaw(location.getYaw() + 180); } } else if (location.getZ() >= maxZ) { if (location.getX() >= 0) { location.setZ(location.getZ() - 2); location.setX(location.getX() - maxX); location.setYaw(location.getYaw() + 180); } else { location.setZ(location.getZ() - 2); location.setX(location.getX() + maxX); location.setYaw(location.getYaw() + 180); } }
update: made the yaw adjust 180 degrees which makes the whole thing feel much smoother
Added in efd6415. Use the earth wrap type.