|
| 1 | +import { describe, test, expect } from "vitest" |
| 2 | +import MirabufParser from "@/mirabuf/MirabufParser" |
| 3 | +import MirabufCachingService, { MiraType } from "@/mirabuf/MirabufLoader" |
| 4 | +import PhysicsSystem, { LayerReserve } from "@/systems/physics/PhysicsSystem" |
| 5 | + |
| 6 | +describe("Mirabuf Physics Loading", () => { |
| 7 | + test("Body Loading (Dozer)", async () => { |
| 8 | + const assembly = await MirabufCachingService.cacheRemote("/api/mira/robots/Dozer_v9.mira", MiraType.ROBOT).then( |
| 9 | + x => MirabufCachingService.get(x!.id, MiraType.ROBOT) |
| 10 | + ) |
| 11 | + const parser = new MirabufParser(assembly!) |
| 12 | + const physSystem = new PhysicsSystem() |
| 13 | + const mapping = physSystem.createBodiesFromParser(parser, new LayerReserve()) |
| 14 | + |
| 15 | + expect(mapping.size).toBe(7) |
| 16 | + }) |
| 17 | + |
| 18 | + /* |
| 19 | + * Multi-Joint Wheels robot contains |
| 20 | + * - 4 wheels (4 revolute joints) |
| 21 | + * - 2 additional revolute joints |
| 22 | + * - 2 slider joints |
| 23 | + * Mira File: https://synthesis.autodesk.com/api/mira/private/Multi-Joint_Wheels_v0.mira |
| 24 | + */ |
| 25 | + test("Body Loading (Multi-Joint Wheels)", async () => { |
| 26 | + const assembly = await MirabufCachingService.cacheRemote( |
| 27 | + "/api/mira/private/Multi-Joint_Wheels_v0.mira", |
| 28 | + MiraType.ROBOT |
| 29 | + ).then(x => MirabufCachingService.get(x!.id, MiraType.ROBOT)) |
| 30 | + const parser = new MirabufParser(assembly!) |
| 31 | + const physSystem = new PhysicsSystem() |
| 32 | + const mapping = physSystem.createBodiesFromParser(parser, new LayerReserve()) |
| 33 | + |
| 34 | + expect(mapping.size).toBe(9) |
| 35 | + }) |
| 36 | +}) |
0 commit comments