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

Fix ground types 'hills' & 'canyon' not using seed #70

Merged
merged 1 commit into from
Oct 8, 2021

Conversation

MakingSpiderSense
Copy link
Contributor

There was an issue where the ground types of 'hills' and 'canyon' were not using the seed. Based on issue #44, it seems that the intention was to use the seed to keep the layout consistent similar to the other ground types, 'noise' and 'spikes'. Below is an explanation of the steps I took to fix the issue:

  • Added custom seed as a parameter to the perlin object in the updateGround function
    • With this change, if the case that "hills" or "canyon" are used, the seed is being passed into the perlin.noise method.
  • In the Perlin Noise Generator, I created a variable called randomWithSeed that will be used in the for loop to generate random numbers using the seed.
    • This logic was essentially taken from the random function defined earlier in the code
    • In that same for loop, I replaced r.random(666) with the new randomWithSeed variable
    • Since the r variable is no longer used, I simplified the function by removing it as a parameter and as well as the line if (r == undefined) r = Math;, which isn't needed.
    • I added seed as a parameter so we can pull in the user's custom seed when generating the randomWithSeed number.

Fixes Issues

@dmarcos
Copy link
Member

dmarcos commented Oct 8, 2021

Thanks and I'm so sorry for the delay!

@dmarcos dmarcos merged commit 88f7a0e into supermedium:master Oct 8, 2021
PiTiLeZarD pushed a commit to PiTiLeZarD/aframe-environment-component-v2 that referenced this pull request May 11, 2022
Fix ground types 'hills' & 'canyon' not using seed
PiTiLeZarD pushed a commit to PiTiLeZarD/aframe-environment-component-v2 that referenced this pull request May 11, 2022
Fix ground types 'hills' & 'canyon' not using seed
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

Successfully merging this pull request may close these issues.

2 participants