Skip to content

threejs中腿的姿势不对 #19

@DazzlingGalaxy

Description

@DazzlingGalaxy

python通过socket将欧拉角和对应的关键点传给blender,blender中能按照摄像头画面运动,YXZ模式。
python通过WebSocket将同样的数据传给vue3中的Three.js,前端头和胳膊的姿势对,腿在收到数据后直接竖直向上,脚跑到头顶了,这是什么原因?
部分前端代码

  console.log("收到消息:", JSON.parse(data));
  const parsedData = JSON.parse(data);
  const { bone, location } = parsedData;
  // 调整骨骼位置
  if (model) {
    for (let i = 0; i < bone.length; i++) {
      const obj = model.getObjectByName(bone[i]);

      model.position.set(location[0], location[2], -location[1]);
      if (obj) {
        const euler = new THREE.Euler(
          parsedData.rotation[i][0] - 0,
          -(parsedData.rotation[i][2] - 0),
          parsedData.rotation[i][1] - 0,
          "YXZ"
        );
        obj.rotation.copy(euler);
      }
    }
  }
});```

![Image](https://github.com/user-attachments/assets/4efaa98f-94bc-42eb-b8db-69edf8807462)

![Image](https://github.com/user-attachments/assets/aeb1036e-b72a-4153-890b-633656bf07ae)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions