diff --git a/public/assets/themes/default/models/base.glb b/public/assets/themes/default/models/base.glb index be5e245..20d3e24 100644 Binary files a/public/assets/themes/default/models/base.glb and b/public/assets/themes/default/models/base.glb differ diff --git a/public/levels/1.json b/public/levels/1.json index e69de29..f5e009b 100644 --- a/public/levels/1.json +++ b/public/levels/1.json @@ -0,0 +1,136 @@ +{ + "version": "1.0", + "difficulty": "rookie", + "timestamp": "2025-11-11T02:25:59.322Z", + "metadata": { + "author": "System", + "description": "Simple rookie training mission with 4 asteroids", + "type": "default" + }, + "ship": { + "position": [ + 0, + 1, + 0 + ], + "rotation": [ + 0, + 0, + 0 + ], + "linearVelocity": [ + 0, + 0, + 0 + ], + "angularVelocity": [ + 0, + 0, + 0 + ] + }, + "startBase": { + "position": [ + 0, + 0, + 0 + ], + "baseGlbPath": "base.glb" + }, + "sun": { + "position": [ + 0, + 0, + 400 + ], + "diameter": 50, + "intensity": 1000000 + }, + "planets": [], + "asteroids": [ + { + "id": "asteroid-0", + "position": [ + 156.94085572623237, + 7.655071329886562, + 26.95900640691752 + ], + "scale": 4.970871148942566, + "linearVelocity": [ + -11.853991319276782, + 3.832852411651826, + 39.00757072935994 + ], + "angularVelocity": [ + -0.42551652358142866, + 0.5493799332739933, + 0.30167035132714326 + ] + }, + { + "id": "asteroid-1", + "position": [ + -23.650269493086213, + -7.516649878848993, + 126.5433266370971 + ], + "scale": 4.200577184263548, + "linearVelocity": [ + 20.279713396596243, + -4.196597143111225, + -5.659116138590411 + ], + "angularVelocity": [ + -0.7507666173804273, + 0.18034984299295997, + 0.9554422970140839 + ] + }, + { + "id": "asteroid-2", + "position": [ + -100.57744425293752, + -4.133377903929796, + -21.366880742332224 + ], + "scale": 3.965322849843854, + "linearVelocity": [ + 18.06997453473912, + 3.1358603251655124, + -35.05836103718289 + ], + "angularVelocity": [ + -0.6169324864147161, + -0.8284153049401051, + -0.0018035515865439944 + ] + }, + { + "id": "asteroid-3", + "position": [ + 45.300201764673865, + -9.859323425039708, + -193.22872370344348 + ], + "scale": 4.373890659454386, + "linearVelocity": [ + 91.37841304510303, + -1.6739562491455018, + 21.422594263117336 + ], + "angularVelocity": [ + 0.39048273397569644, + 0.8814713796198581, + -0.972535786522579 + ] + } + ], + "difficultyConfig": { + "rockCount": 4, + "forceMultiplier": 1, + "rockSizeMin": 3, + "rockSizeMax": 5, + "distanceMin": 100, + "distanceMax": 200 + } +} \ No newline at end of file diff --git a/public/levels/directory.json b/public/levels/directory.json index e69de29..837f7fd 100644 --- a/public/levels/directory.json +++ b/public/levels/directory.json @@ -0,0 +1,30 @@ +{"missions": [ + { + "id": 1, + "name": "Recruit", + "Description": "Simple level to get the hang of things", + "missionbrief": [ + "Destroy the asteroids", + "return to base after they're destroyed to complete the mission", + "return to base if you need more fuel, ammo, or hull repairs", + "don't get too far from base, if you run out of fuel, you'll be stranded", + "don't run into things, it damages your hull" + ], + "leveldata": "/levels/1.json", + "defaultlocked": false + } , + { + "id": 2, + "name": "Fuel Management", + "Description": "Don't run out of fuel", + "missionbrief": [ + "Astroids are further away and there a more of them", + "you'll need to keep an eye on your fuel levels", + "return to base after you've destroyed them all" + ], + "leveldata": null, + "defaultlocked": true + } +] + +} \ No newline at end of file diff --git a/src/environment/celestial/planetTextures.ts b/src/environment/celestial/planetTextures.ts index 3537c0b..bbe1dd8 100644 --- a/src/environment/celestial/planetTextures.ts +++ b/src/environment/celestial/planetTextures.ts @@ -214,12 +214,4 @@ export const PLANET_TEXTURES_BY_TYPE = { "/assets/materials/planetTextures/Tundra/Tundra_04-512x512.png", "/assets/materials/planetTextures/Tundra/Tundral-EQUIRECTANGULAR-5-512x512.png", ], -}; - -/** - * Get a random texture from a specific planet type - */ -export function getRandomTextureByType(type: keyof typeof PLANET_TEXTURES_BY_TYPE): string { - const textures = PLANET_TEXTURES_BY_TYPE[type]; - return textures[Math.floor(Math.random() * textures.length)]; -} +}; \ No newline at end of file diff --git a/src/environment/stations/starBase.ts b/src/environment/stations/starBase.ts index eae923d..30d5373 100644 --- a/src/environment/stations/starBase.ts +++ b/src/environment/stations/starBase.ts @@ -1,9 +1,8 @@ import { AbstractMesh, - HavokPlugin, Mesh, PhysicsAggregate, PhysicsMotionType, - PhysicsShapeType, + PhysicsShapeType, TransformNode, Vector3 } from "@babylonjs/core"; import {DefaultScene} from "../../core/defaultScene"; @@ -39,9 +38,8 @@ export default class StarBase { } // Apply position to both meshes (defaults to [0, 0, 0]) - const pos = position ? new Vector3(position[0], position[1], position[2]) : new Vector3(0, 0, 0); - baseMesh.position = pos.clone(); - landingMesh.position = pos.clone(); + (importMeshes.container.rootNodes[0] as TransformNode).position + = position ? new Vector3(position[0], position[1], position[2]) : new Vector3(0, 0, 0); let landingAgg: PhysicsAggregate | null = null; @@ -57,14 +55,7 @@ export default class StarBase { landingAgg = new PhysicsAggregate(landingMesh, PhysicsShapeType.MESH); landingAgg.body.setMotionType(PhysicsMotionType.ANIMATED); - /*landingAgg.body.getCollisionObservable().add((collidedCollidedBody) => { - - });*/ landingAgg.shape.isTrigger = true; - /*(DefaultScene.MainScene.getPhysicsEngine().getPhysicsPlugin() as HavokPlugin).onTriggerCollisionObservable.add((eventdata, eventState) => { - console.log(eventState); - console.log(eventdata); - })*/ landingAgg.body.setCollisionCallbackEnabled(true); } //importMesh.rootNodes[0].dispose(); @@ -73,14 +64,4 @@ export default class StarBase { landingAggregate: landingAgg }; } -} -function clearParent (meshes: Map, position?: Vector3) { - meshes.forEach((mesh) => { - mesh.setParent(null); - if (position) { - mesh.position = position; - } - - DefaultScene.MainScene.addMesh(mesh); - }) -} +} \ No newline at end of file