Box2d 布娃娃自定义动画

发布于 2024-12-12 00:36:29 字数 326 浏览 0 评论 0原文

我有一个布娃娃,完全由物理控制,但我想自己控制它,添加动画,当我点击身体的每个部分时,它的行为完全是物理的

我所做的是

  1. 完全用物理和关节创建布娃娃
  2. 能够拖动它的任何部分
  3. 将状态设置为动画,并将每个人的状态更改为运动学

我现在想做的是独立地对每个部分执行我的动画,我的意思是,改变它的位置和角度,问题:

  1. 当我转动手臂和腿,从中心旋转,我希望它从“关节点”旋转,这样我就可以通过简单的 setTransform(pos, angle) 控制手臂角度,

我怎样才能实现这一点?

I have a ragdoll, completely controlled by physics, but I want to controll it by myself, adding an animation, and when I click on each part of the body, it acts completely physical

What I did was

  1. Create the ragdoll completely with physics and joints
  2. Be able to drag any part of it
  3. Set state as animation and it changes the state of everybody to kinematic

What I want to do now is perform my animation to each part independently, I mean, change its position and its angle, problems:

  1. When I rotate the arm and the legs, it rotates from the center, and I want it to rotate from the "joint point", so I can controll the arm angle with a simple setTransform(pos, angle)

How can I achieve this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

俯瞰星空 2024-12-19 00:36:29

通常,当你的角色被杀死时,会使用布娃娃来模拟它的真实坠落。所以我认为你并不真的需要一直对你的角色进行物理模拟。更重要的是,如果您只是设置它的位置,无论如何您都会得到非物理行为(您的角色的每个部分至少应该有正确的速度,否则由于碰撞处理不正确,模拟将不现实)。因此,通常只需制作一个 AABB 或绑定球体来控制角色移动时的碰撞就足够了。当角色死亡时 - 制作一个布娃娃来模拟死亡。所以我建议你将角色的图形和物理表示分开,死亡除外

Usually ragdolls are used when your character is killed to simulate it fall realistic. So i don't think you really need your character to be physical simulated all the time. More of this, if you will just set it's position you will get non-physical behavior anyway (you should at least have correct velocities for every part of your character, otherwise the simulation will not be realistic because of incorrect collision processing). So usually it's enough just to make an AABB or a bound sphere for controlling collisions with you character while moving. When the character dies - make a ragdoll to simulate the death. So i suggest you to separate graphical and physical representation of your character except death

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文