You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何实现Spherical Joint锚点跟随glTF模型的位置与旋转

问题:让Spherical Joint锚点跟随glTF模型的位置与旋转

我需要让Spherical Joint锚点遵循rapier文档示例中的锚点逻辑,跟随加载的glTF模型边缘的位置与旋转变化。目前已通过每帧调用以下代码实现位置跟随:

const move = (leftAnchor, rightAnchor) => {

    /**
     *  model: 包含glTF模型的组的引用
     *  leftAnchorPos: leftAnchor的初始位置
     *  rightAnchorPos: rightAnchor的初始位置
     */
    const modelPos = model.current.position
    const leftPos = new Vector3(
        leftAnchorPos.x + modelPos.x,
        leftAnchorPos.y + modelPos.y,
        leftAnchorPos.z + modelPos.z)
    const rightPos = new Vector3(
        rightAnchorPos.x + modelPos.x,
        rightAnchorPos.y + modelPos.y,
        rightAnchorPos.z + modelPos.z)

    leftAnchor.setNextKinematicTranslation(leftPos)
    rightAnchor.setNextKinematicTranslation(rightPos)

}

但我无法让锚点正确跟随模型的旋转,想了解是否有更简便的实现方式。


内容的提问来源于stack exchange,提问作者A7med

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.30 21:21:49