Skip to content

Bug with negative input AND solution #1

@Holonist

Description

@Holonist

Hi, first of all thank you for this class, it is truly amazing.
I use it to generate the world for my game.

Problem:
When x or y or both are negative values, the output of the nosie2D function becomes very weird and fragmented.

Solution:
In public function interpolatedNoise($x, $y)
change lines 102 and 105 like this:
102: $integerX = (int) floor($x);
205: $integerY = (int) floor($y);

The floor() function did the trick here. Positive values remain unchanged in my tests, while negative values now produce the same nice results!

Cheers, Holo

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions