如何动态更换模型挂载点昵(换武器)

我是如下写法:
let skeaniCmp: SkeletalAnimationComponent = this.node.getChildByName(“body”)?.getComponent(SkeletalAnimationComponent)!

skeaniCmp.sockets[0].path=“body/RootNode/Hips/Spine/Spine1/Spine2/RightShoulder/RightArm/RightForeArm/RightHand/Sword_joint”

skeaniCmp.sockets[0].target=this.node.getChildByPath(“weapon”)

用上面代码方法写没有用。。。

你挂载的节点固定住。让将武器作为子节点,接入到挂载节点下边呀。替换武器就是加新的子节点,销毁旧的子节点呀

1赞

试过,可以,谢谢