20 lines
806 B
JavaScript
20 lines
806 B
JavaScript
|
|
"use strict";
|
||
|
|
|
||
|
|
// Layer: physics/mechanical-shape-bridge
|
||
|
|
// Single read-only facade for mechanical shape/footprint queries. It keeps
|
||
|
|
// world, placement, and renderer code from binding directly to the body solver.
|
||
|
|
(function (global) {
|
||
|
|
function mech() { return global.TarinaiMechanicalSystem || null; }
|
||
|
|
|
||
|
|
function isMechanicalType(itemOrType) { return Boolean(mech()?.isMechanicalType?.(itemOrType)); }
|
||
|
|
function obstacleRects(item) { return mech()?.obstacleRects?.(item) || []; }
|
||
|
|
function extent(item) { return mech()?.extent?.(item) || 0; }
|
||
|
|
function reach(item) { return mech()?.reach?.(item) || extent(item); }
|
||
|
|
|
||
|
|
global.TarinaiMechanicalShapeSystem = Object.freeze({
|
||
|
|
isMechanicalType,
|
||
|
|
obstacleRects,
|
||
|
|
extent,
|
||
|
|
reach,
|
||
|
|
});
|
||
|
|
})(typeof window !== "undefined" ? window : globalThis);
|