Glowstick0017 / Little-Plane-Project

Flying through a procedural web world
https://glowstick.me/tlpp/
MIT License
102 stars 26 forks source link

Map Scaling not occuring from the center point #43

Open theDRB123 opened 11 months ago

theDRB123 commented 11 months ago

Describe the bug The map should be scaled with airplane at the origin when moving Up and down , but instead it is scaling from the top-left corner

To Reproduce Steps to reproduce the behavior:

  1. Click on 'up / down'
  2. See error

Expected behavior The origin for scaling should be the airplane (as it is moving up and the environment should correspond to it)

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

image scaled from top left corner image

i wish to work on this issue...

Glowstick0017 commented 11 months ago

@theDRB123 I assigned you to this issue. This is something i've looked into, the problem gets worse the further you are away from the origin of the perlin generation which is that corner. The reason this happens is to keep the coordinates relative to the origin so that if you scale in or out, move the plane, then scale back to the original, the coordinates would show you moved as much as you would without scaling at all. If we change the scaling to center on the plane, we'll probably have to change the speed of the plane relative to the scaling so the coordinates would still line back up when scaling back.

theDRB123 commented 11 months ago

Yeah , I think i have to change a lot the current implementation is also causing another problem that when it gains height , the terrain starts Moving even faster instead of getting slower , should i change some complex stuff too ? I will take care not to break stuff

Glowstick0017 commented 11 months ago

You can change as much as you'd like to get this issue resolved, as long as the core concept with perlin noise and procedural generation stands and current features aren't broken. The biggest would be making sure that when you enter a seed and coordinates you've been to before, it will be the exact same generation every time.

theDRB123 commented 11 months ago

I am getting really confused , if possible can you just provide me with a just starting point , from where i may start to try and mitigate the issue (i am a beginner in games and JS both so sometimes i get really confused) , thanks .

theDRB123 commented 11 months ago

I have encountered a problem which is occuring when we change the up/down behaviour , when the x/y are scaling and PosX and PosY aren't , they go out of sync and thus are causing , some shaking effect ... so should i make a pull request for solving the scaling , and then solve the shaking problem after it ?

Glowstick0017 commented 11 months ago

currently the shaking affect has been handled by @anttijankeri in https://github.com/Glowstick0017/Little-Plane-Project/pull/44 and https://github.com/Glowstick0017/Little-Plane-Project/pull/48 . If we can implement the scaling to what we have now, that would solve this map scaling issue.

theDRB123 commented 11 months ago

I am sorry , i am a bit late but i have added the PR ... the shaking issue seems to be quite prevailant , i was not able to fix that....