Skip to content

Added changeable ground dimension feature.#2

Open
AliShahsavandInanloo wants to merge 2 commits intokeyserjaya:mainfrom
AliShahsavandInanloo:feature/changeable-ground-dimension
Open

Added changeable ground dimension feature.#2
AliShahsavandInanloo wants to merge 2 commits intokeyserjaya:mainfrom
AliShahsavandInanloo:feature/changeable-ground-dimension

Conversation

@AliShahsavandInanloo
Copy link

Hey, I recently found your infinite ground script which is pretty dope, but it was limited to just 9 grounds. so I decided to make it unlimited with the number of ground parts used.

Copy link
Owner

@keyserjaya keyserjaya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, first of all.
Thank you for your pull request!

I've tried your code and there's a few bug:

  • groundPieceSize didn't works
  • using System; is missing

Also, i have suggestion:

  • Change System.Math.Floor to UnityEngine.Mathf.FloorToInt()

That's it, everything is nice, just a little revision left

@AliShahsavandInanloo
Copy link
Author

Hey, I've applied the changes that you requested,
I decided to remove the groundPieceSize from the serialized fields because it made no sense when we can access the prefab size from the mesh renderer.

and also I have fixed the "using System; is missing" bug.

There is just one little problem with the groundDimension, when we input it with 5 and 9 and probably some other odd numbers, when you put 5 it should give you a 5 x 5 ground which has 25 pieces, but it gives 16 pieces and there is the similar problem with number 9, it doesn't generate 81 pieces it generates 49 (which is 7 x 7).

MGTechTeam1

This comment was marked as outdated.

Copy link
Owner

@keyserjaya keyserjaya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, i have tested your code and sample scene.
It was great, because you're using mesh bounds as _groundPieceSize.

Unfotunately there's still bugs:

  1. When change Ground Dimension (i tried 9) the next ground will be too far
  2. The _newGroundTrigger was too far, because the target(player) must be too corner to trigger new ground (so the empty space was visible to the camera).
    Solution: new float triggerRangeMultiplier will be good.

Sorry to many request, because i want the users to get nice working code.
Also thank you so much for your collaboration!
image

@keyserjaya keyserjaya requested a review from MGTechTeam1 March 27, 2023 13:16
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.

3 participants