Skip to content

Commit

Permalink
fixed black hole demo
Browse files Browse the repository at this point in the history
it was broken as it was not using a custom system model
  • Loading branch information
BarthPaleologue committed Sep 6, 2024
1 parent b193099 commit e09c7e5
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions src/ts/blackHoleDemo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,24 @@ import { StarSystemController } from "./starSystem/starSystemController";

import { positionNearObjectBrightSide } from "./utils/positionNearObject";
import { CosmosJourneyer } from "./cosmosJourneyer";
import { StarSystemHelper } from "./starSystem/starSystemHelper";
import { SystemSeed } from "./utils/systemSeed";
import { CustomStarSystemModel } from "./starSystem/customStarSystemModel";
import { BodyType } from "./architecture/bodyType";

const engine = await CosmosJourneyer.CreateAsync();

const starSystemView = engine.starSystemView;

const scene = starSystemView.scene;

const starSystemSeed = new SystemSeed(0, 0, 0, 0);
const starSystem = new StarSystemController(starSystemSeed, scene);
const starSystemModel = new CustomStarSystemModel("Black Hole Demo", [[BodyType.BLACK_HOLE, 0]], [[BodyType.TELLURIC_PLANET, 42]], []);
const starSystem = new StarSystemController(starSystemModel, scene);

const BH = StarSystemHelper.MakeBlackHole(starSystem, 0);
BH.model.orbit.radius = 0;
BH.model.physicalProperties.accretionDiskRadius = BH.model.radius * 12;

const planet = StarSystemHelper.MakeTelluricPlanet(starSystem);
planet.model.orbit.radius = 45 * planet.getRadius();
planet.model.orbit.period = 24 * 60 * 60;

await starSystemView.loadStarSystem(starSystem, false);
await starSystemView.loadStarSystem(starSystem, true);

engine.init(true);

starSystemView.switchToDefaultControls();

const BH = starSystem.stellarObjects[0];

positionNearObjectBrightSide(scene.getActiveControls(), BH, starSystem, 20);

0 comments on commit e09c7e5

Please sign in to comment.