calibrate-model
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseModel calibration
模型校准
Use the skill to measure every unique GLB before mass placement. Rely on and
for contact-accurate placement only when it reports . Store
one tuning record per asset:
inspect-glbdimsgroundOffsetboundsSource: verticests
const ASSET_TUNING = {
model: {
boundsSource: 'vertices',
aabb: { min: [-4, -1, -9], max: [4, 6, 9] },
dims: [8, 7, 18],
center: [0, 2.5, 0],
groundOffset: 1,
intended: { dimension: 'length', size: 18 },
scale: 0.9,
y: 0.9,
yaw: 180
}
} as const;在批量放置之前,使用工具测量每个唯一的GLB模型。仅当它报告时,才可依靠和实现精准贴合的放置。为每个资源存储一条调优记录:
inspect-glbboundsSource: verticesdimsgroundOffsetts
const ASSET_TUNING = {
model: {
boundsSource: 'vertices',
aabb: { min: [-4, -1, -9], max: [4, 6, 9] },
dims: [8, 7, 18],
center: [0, 2.5, 0],
groundOffset: 1,
intended: { dimension: 'length', size: 18 },
scale: 0.9,
y: 0.9,
yaw: 180
}
} as const;Calculate the record
计算记录值
- Pick and record the intended dimension and size: character height, building footprint, or vehicle length. Base it on world units or an already calibrated reference model.
- Calculate .
scale = intendedSize / measuredDimension - For a floor-resting model, calculate . Record a deliberate offset for waterlines, embedded objects, or airborne models.
y = groundOffset * scale - Confirm directional facing once in the running app, as the skill describes. PlayCanvas entities face -Z while glTF convention is +Z, but asset packs vary.
apply-conventions - Retain ,
boundsSource,aabb,dims,center, and the intended size withgroundOffset. Use the scaled footprint and centre for initial spacing; do not re-derive or add per-instance nudges.{ scale, y, yaw }
Keep gameplay position and heading on an outer semantic root, and seat the model on one predictable
reference point beneath it so a root position means the same thing for every asset: by default the
footprint centre over the base. Apply the authored yaw on a wrapper, then the scale and the full
offset on the render child inside it, so an off-centre pivot is compensated in the authored frame and
never re-rotated by the yaw or by gameplay heading:
ts
const yaw = new Entity('yaw');
yaw.setLocalEulerAngles(0, t.yaw, 0);
const visual = instantiate(asset);
visual.setLocalScale(t.scale, t.scale, t.scale);
visual.setLocalPosition(-t.center[0] * t.scale, t.y, -t.center[2] * t.scale);
yaw.addChild(visual);
root.addChild(yaw);Keep as the local correction that brings the measured minimum to the root plane; the X and Z
terms bring the footprint centre onto the root axis. Place that root at a measured support point. A support name or global AABB maximum is not
a surface measurement. Use an authored mount point or runtime support query for curved or stepped
geometry. Treat skinned bounds as bind-pose estimates and confirm foot contact in the active poses.
yRead exactly one reference matching the code being edited:
direct Engine, React, or
Web Components. Choose from imports and markup, not installed
dependencies alone.
- 选择并记录目标维度和尺寸:角色高度、建筑占地面积或车辆长度。以世界单位或已校准的参考模型为基准。
- 计算(缩放比例 = 目标尺寸 / 测量维度)。
scale = intendedSize / measuredDimension - 对于放置在地面的模型,计算。对于吃水线、嵌入式物体或悬空模型,需记录一个自定义偏移量。
y = groundOffset * scale - 按照工具的说明,在运行的应用中确认方向朝向。PlayCanvas实体朝向-Z方向,而glTF标准是+Z,但不同资源包可能存在差异。
apply-conventions - 保留、
boundsSource、aabb、dims、center以及包含groundOffset的目标尺寸。使用缩放后的占地面积和中心值进行初始布局;请勿重新推导或添加每个实例的微调值。{ scale, y, yaw }
将游戏玩法中的位置和朝向设置在外层语义根节点上,并将模型固定在其下方一个可预测的参考点上,这样根节点位置对每个资源都具有相同的含义:默认情况下是底部上方的占地面积中心。在包装器上应用预设的偏航值,然后在其内部的渲染子节点上应用缩放比例和完整偏移量,这样偏心枢轴会在预设坐标系中得到补偿,且不会被偏航值或游戏玩法朝向重新旋转:
ts
const yaw = new Entity('yaw');
yaw.setLocalEulerAngles(0, t.yaw, 0);
const visual = instantiate(asset);
visual.setLocalScale(t.scale, t.scale, t.scale);
visual.setLocalPosition(-t.center[0] * t.scale, t.y, -t.center[2] * t.scale);
yaw.addChild(visual);
root.addChild(yaw);将作为使测量最小值对齐到根平面的局部校正值;X和Z项将占地面积中心对齐到根轴。将该根节点放置在测量得到的支撑点上。支撑点名称或全局AABB最大值并非表面测量值。对于曲面或阶梯状几何形状,请使用预设挂载点或运行时支撑查询。将蒙皮边界视为绑定姿态的估算值,并在活动姿态中确认脚部接触情况。
y请阅读与正在编辑的代码完全匹配的参考文档:直接Engine、React或Web Components。请从导入项和标记中选择,而不仅仅依赖已安装的依赖项。