求助资料库内的武器怎么能够装在人物身上

[复制链接]
316 |2
桃酥萝莉 发表于 2024-6-4 21:26:54 | 显示全部楼层 |阅读模式
求助资料库内的武器怎么能够装在人物身上,大佬们有什么好方法吗
回复

使用道具 举报

汽水 发表于 2024-6-4 21:35:25 | 显示全部楼层
在编辑器中没有“装备”的概念,想要实现讲一个模型附着在玩家身上可以使用以下两种方案:
1. 使用角色编辑器换装,这种方案会将生死所有挂件全部替换https://learning.ark.online/Comm ... 1%E6%95%B0%E6%8D%AE

2. 使用代码按部位换装,下面是一个示例,演示了将一个模型挂载右手上(挂载钱删除了右手上所有挂件)
  1.             // 右手上的武器插槽
  2.             const handGoList = player.character.description.advance.slotAndDecoration.slot[HumanoidSlotType.RightHand].decoration;
  3.             // 删除旧的
  4.             for (let index = 0; index < handGoList.length; index++) {
  5.                 const goInfo = handGoList[index];
  6.                 goInfo.attachmentGameObject.destroy();
  7.             }
  8.             handGoList.clear();
  9.             // 生成新的
  10.             const weaponObj = await GameObject.asyncSpawn<Model>(weaponInfo.modelAssetId);
  11.             weaponObj.setCollision(CollisionStatus.Off);
  12.             const index = handGoList.add(weaponObj, this._transformCache);
复制代码
回复

使用道具 举报

桃酥萝莉楼主 发表于 2024-6-4 22:23:23 | 显示全部楼层
非常感谢
回复

使用道具 举报

热门版块
快速回复 返回顶部 返回列表