Model viewer working with all default pack models
This commit is contained in:
@@ -148,6 +148,24 @@ for (const w of wolfCenters) {
|
||||
assert(wTail.center[2] > 8, `wolf tail behind body (z=${wTail.center[2].toFixed(1)})`);
|
||||
assert(wBody && wTail.center[2] > wBody.center[2], 'tail z > body z');
|
||||
|
||||
// ---------- 5. Real polar bear: cube-level pivot + rotation ----------
|
||||
// The polar bear's rear torso cube has its own pivot/rotation; rotating around
|
||||
// the cube origin (not its pivot) sent it flying to z≈48. Regression test.
|
||||
const polar = require(path.join(__dirname, 'fixtures', 'polar_bear.geo.json'));
|
||||
const polarBuilt = GeoBuilder.build(polar);
|
||||
const polarCubes = polarBuilt.cubes.map(c => ({ c, center: worldCenter(c.matrix) }));
|
||||
const pRear = polarCubes.find(({ c }) => c.size[0] === 18.2 && c.size[1] === 18.2 && c.size[2] === 14.3);
|
||||
assert(!!pRear, 'polar bear rear torso cube found');
|
||||
if (pRear) {
|
||||
assertVec(pRear.center, [0, 17.55, 7.8], 'polar bear rear torso center (expect (0,17.55,7.8))');
|
||||
}
|
||||
const pFront = polarCubes.find(({ c }) => c.size[0] === 15.6 && c.size[1] === 15.6 && c.size[2] === 13);
|
||||
if (pFront) {
|
||||
// Rear torso sits behind and at the same height as the front torso.
|
||||
assert(pRear.center[2] > pFront.center[2], 'rear torso behind front torso');
|
||||
assert(approx(pRear.center[1], pFront.center[1], 1.5), 'rear + front torso at similar height');
|
||||
}
|
||||
|
||||
// ---------- summary ----------
|
||||
if (failures === 0) {
|
||||
console.log(`geo_builder tests OK (${checks} checks)`);
|
||||
|
||||
Reference in New Issue
Block a user