Szum123321 / elytra_swap

Automatic elytra replacement with chestplace and more
https://www.curseforge.com/minecraft/mc-mods/elytra-swap
GNU General Public License v3.0
3 stars 2 forks source link

Takeoff math is incorrect #21

Closed Tofugrass closed 4 years ago

Tofugrass commented 4 years ago

y velocity is calculated without considering the direction the player is facing. You can look into a hole but you will takeoff upwards. y should be -Math.sin(Math.toRadians(player.pitch)) * ElytraSwap.CONFIG.kickSpeed .

unless pitch is positive by default, then the signs are switched.

Szum123321 commented 4 years ago

Why would you want to takeoff downwards?

I know it isn't there, because that's how I designed it.

Tofugrass commented 4 years ago

If I am looking straight down and try to take off, why should it go upwards?

Szum123321 commented 4 years ago

Because... You are trying to takeoff... Not slam into ground....

Tofugrass commented 4 years ago

how are you calculating the y velocity WITHOUT EVEN LOOKING AT PLAYER'S PITCH? That is how up or down the player is looking. How are you calculating a y velocity without it? Explain to me how this makes any sense at all. I'm not sure if you use your own mod, but it doesn't matter which direction you're facing, the takeoff angle is always the same. Whats the point in always making the player takeoff in the same upwards angle, if they dont always want to go upwards? Your mod does not allow a player to go sideways or down. Sometimes a player wants to go a direction that is not straight up. Your mod lacks functionality if a player can only takeoff in one direction, and all other directions are ignored. Also because of this super strange takeoff math that ignores player direction, your mod obviously does not fit with the vanilla flight mechanics at all. Since your mod differs so heavily from vanilla flight mechanics, you are forcing each user to learn the flight mechanics that your mod introduces. Your mod should not be introducing new flight mechanics besides being able to takeoff without a jump,

Tofugrass commented 4 years ago

you closed the issue? LOL dude u are such a bad programmer its ridiculous.

Tofugrass commented 4 years ago

normally when a user reports a bug, the programmer says thank you for catching my mistake, and they fix it.

You do realize that you can't even use a firework if you are looking at a block? In order to take off downwards, there would have to be open space downwards. As in, the player is above something and actually wants to travel downwards. If the player ACTUALLY wants to travel downwards, why are you sending him up?

Szum123321 commented 4 years ago

If you want to travel down you can always just jump down

Tofugrass commented 4 years ago

the point is if the player is trying to travel downwards using vanilla flight mechanics with your mod, why are they sent upwards. the least you could do is try it yourself and try it with the changes and see if you agree with me.

Tofugrass commented 4 years ago

there are situations where the player would be unable to jump down. and there are situations where the player wants to travel sideways.

Szum123321 commented 4 years ago

If I want to fall down I just fall down, not scream on someone who disagrees with me.

Tofugrass commented 4 years ago

you dont think its crazy that your mod that modifies flying in the game, doesnt take into account how vertical the player is looking, when flight is based on where you are looking?

Szum123321 commented 4 years ago

Maybe

Szum123321 commented 4 years ago

I've seen how easy elytra takeoff works, and yes, it might be more intuitive in some cases

Tofugrass commented 4 years ago

thats not mind boggling to you? flying isnt in the game, only gliding. the only thing in this game that matters is how vertical the player is looking. literally, that is the only variable that matters when it comes to flight. you do not use it once.

Tofugrass commented 4 years ago

its more intuitive in every case, i play the game a lot in a large server

Tofugrass commented 4 years ago

its such a quick change just test it and see how it feels

Tofugrass commented 4 years ago

they copied vanilla mechanics completely so its smooth as butter. you dont know u have a mod installed. except for the fact that taking off is super clean

Szum123321 commented 4 years ago

Alright, I'll give it a try

Tofugrass commented 4 years ago

and the reason im angry is because this seems like quite an important issue to consider for a glider mod and u closed it instantly with the reason "Because... You are trying to takeoff... Not slam into ground...." its not possible to slam into the ground so that lets me know that u arent taking me seriously, or u havent tested it or i dont know what, but thats not possible to do so its quite triggering

Tofugrass commented 4 years ago

thank you for trying, we could easily add a config where the user can decide if they want to go mostly vertical or just in the direction they are facing. do you want me to do that in a pull request quick? that make the mod better than easy elytra since they dont have a config for vertical takeoff

Szum123321 commented 4 years ago

I have to think about it

Tofugrass commented 4 years ago

if you add you change y to this, then you wont notice a change but i will: (ElytraSwap.CONFIG.verticalMode ? ElytraSwap.CONFIG.kickSpeed : -Math.sin(Math.toRadians(player.yaw)) * ElytraSwap.CONFIG.kickSpeed),

Szum123321 commented 4 years ago

Then it doesn't play well with swapping mechanism

Tofugrass commented 4 years ago

can u link me a test tar.gz

Szum123321 commented 4 years ago

gimme a sec

Tofugrass commented 4 years ago

how is the takeoff tho

Szum123321 commented 4 years ago

I'm not sure. Honestly I think I prefer the old way, but if you really want it, I can add it

Szum123321 commented 4 years ago

elytra_swap-2.2.0-1.16.2.jar.tar.gz Here you go

Tofugrass commented 4 years ago

did u see the pull requests, i defaulted the new verticalmode config to enable, so you would never notice the change. with vertical mode enabled there is no change. someone would have to go into config to change that.

Tofugrass commented 4 years ago

no one would notice the change by default unless they want to

Szum123321 commented 4 years ago

It's possible that 1.7 is just too little. Yes I've seen it.

Tofugrass commented 4 years ago

i mean, then the player can change that in the config if they want to take it off of vertical mode, its perfect. i play with the swap disabled, because its a little op

Szum123321 commented 4 years ago

Ok. My main trouble is that elytra gets swapped only when falling so giving player variable vertical speed might cause swapping to never be called. (For me it is the main feature, but whatever)

Tofugrass commented 4 years ago

wouldnt it make more sense to do the swap before taking off? see #20

it doesnt make sense to have a wingless person flying through the air

Szum123321 commented 4 years ago

I'm working on it

Szum123321 commented 4 years ago

I think some requested that to be added some time ago

Szum123321 commented 4 years ago

elytra_swap-2.3.0-1.16.2.jar.tar.gz

Tofugrass commented 4 years ago

thank you

Tofugrass commented 4 years ago

after some testing I have some thoughts on horizontal mode. i think the easiest and quickest fix would be to have the mod make the player jump shortly after the player takesoff in horizontal mode only. so right after the velocity packet in takeoff handler.

this is because i think vanilla flight uses acceleration rather than velocity so, by us sending an initial starting velocity that is not zero, the player travels much farther than they would with a regular rocket.

the easiest way to fix that issue in my opinion, is in horizontal mode only, we could use a small velocity to multiply each x,y,z by instead of the config.

i think for the testing build we should keep using the config speed and just add a jump in horizontal mode, so i can tell you what small velocity constant we should use.

besides the player traveling farther, their direction is also not as fluent, because they started traveling at a high velocity at a precise angle, so as the player naturally adjusts the mouse left and right, the game ignores it.

having the player jump immediately after taking off would fix all these issues (hard for player to turn at high config.kickSpeed, and player traveling farther than normal) since the vanilla flight mechanics would immediately take over shortly after the player leaves the ground. all we have to is send the game a jump in horizontal mode after takeoff.

Tofugrass commented 4 years ago

also by sending the jump in horizontal mode, we dont need to consider the direction the player is facing for the y velocity. the game handles all of that for us immediately after we force the jump and the wings take over. which will happen so fast the player will not even notice.

the only difference between horizontal mode and vertical mode then becomes if we force the jump or let the player do it themselves and the takeoff speed is cut in half for horizontal mode.