Put planet in center of map
This commit is contained in:
parent
e7f9007b23
commit
0e22f9b33d
1 changed files with 21 additions and 11 deletions
|
|
@ -22,7 +22,7 @@ export const createWorld = (objectContainer: PhysicalContainer, worldRadius: num
|
||||||
rad,
|
rad,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (Random.getRandom() > 0.5) {
|
if (objects.length !== 0 && Random.getRandom() > 0.5) {
|
||||||
if (
|
if (
|
||||||
evaluateSdf(position, objects) > 200 &&
|
evaluateSdf(position, objects) > 200 &&
|
||||||
!lights.find((l) => l.distance(position) < 2500)
|
!lights.find((l) => l.distance(position) < 2500)
|
||||||
|
|
@ -44,16 +44,26 @@ export const createWorld = (objectContainer: PhysicalContainer, worldRadius: num
|
||||||
evaluateSdf(position, objects) > 1400 &&
|
evaluateSdf(position, objects) > 1400 &&
|
||||||
!lights.find((l) => l.distance(position) < 1700)
|
!lights.find((l) => l.distance(position) < 1700)
|
||||||
) {
|
) {
|
||||||
objects.push(
|
const planet =
|
||||||
new PlanetPhysical(
|
objects.length === 0
|
||||||
PlanetBase.createPlanetVertices(
|
? new PlanetPhysical(
|
||||||
position,
|
PlanetBase.createPlanetVertices(
|
||||||
Random.getRandomInRange(300, 1600),
|
position,
|
||||||
Random.getRandomInRange(300, 1600),
|
Random.getRandomInRange(1600, 2400),
|
||||||
Random.getRandomInRange(20, 100),
|
Random.getRandomInRange(1600, 2400),
|
||||||
),
|
Random.getRandomInRange(80, 300),
|
||||||
),
|
),
|
||||||
);
|
)
|
||||||
|
: new PlanetPhysical(
|
||||||
|
PlanetBase.createPlanetVertices(
|
||||||
|
position,
|
||||||
|
Random.getRandomInRange(300, 1600),
|
||||||
|
Random.getRandomInRange(300, 1600),
|
||||||
|
Random.getRandomInRange(20, 100),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
objects.push(planet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue