Skip to content

Commit 8d95ec7

Browse files
Auto wheel assignment for native mira imports [SYNTH-292] (#1456)
2 parents c9d005a + d7e76e5 commit 8d95ec7

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

fission/src/mirabuf/MirabufLoader.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import InitialConfigPanel from "@/panels/configuring/initial-config/InitialConfi
88
import { PAUSE_REF_ASSEMBLY_SPAWNING } from "@/systems/physics/PhysicsTypes.ts"
99
import { createMirabuf } from "@/mirabuf/MirabufSceneObject.ts"
1010
import { getTargetControls } from "@/systems/scene/CameraControls.ts"
11+
import { detectAndTagWheels } from "@/systems/simulation/synthesis_brain/WheelDetector"
1112
import type { EncodedAssembly, Message } from "@/systems/multiplayer/types.ts"
1213
import { ProgressHandle } from "@/components/ProgressNotificationData.ts"
1314

@@ -271,6 +272,10 @@ class MirabufCachingService {
271272
return
272273
}
273274

275+
if (assembly.dynamic) {
276+
detectAndTagWheels(assembly)
277+
}
278+
274279
const info = await MirabufCachingService.storeAssemblyInCache(assembly, { miraType })
275280
if (!info) return
276281

fission/src/systems/simulation/synthesis_brain/WheelDetector.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,9 @@ export function detectAndTagWheels(assembly: mirabuf.Assembly): void {
287287
const jointDefs = assembly.data?.joints?.jointDefinitions as Record<string, mirabuf.joint.IJoint> | undefined
288288
if (!jointDefs) return
289289

290+
const hasExistingWheels = Object.values(jointDefs).some(jDef => jDef.userData?.data?.["wheel"] === "true")
291+
if (hasExistingWheels) return
292+
290293
const candidates = extractCandidates(jointDefs)
291294
if (candidates.length < 2) return
292295

0 commit comments

Comments
 (0)