INNER CODE UNIT · JavaScript
excluded
MageStudio/Mage · src/physics/index.js:381
const excluded = new Set(siblingBodies.filter(b => b !== body));
// Orientation of this collider relative to the compound root. The root
// body carries no scale, so children are placed with rotation +
// translation only.
const localQuat = invRootQuat.clone().multiply(worldQuat);
const { worldCenter, size } = this.measureCollider(body, worldQuat, excluded);
// Position the shape at the collider's true world CENTER (a mesh's
// geometry can be offset from its element origin), in the root's frame.
const localPos = worldCenter.clone().sub(rootWorldPos).applyQuaternion(invRootQuat);
const shape = {
childUuid: element.uuid(),
colliderType,
localPosition: { x: localPos.x, y: localPos.y, z: localPos.z },
localQuaternion: { x: localQuat.x, y: localQuat.y, z: localQuat.z, w: localQuat.w },