Box2d:滚动柔软的身体球 [英] Box2d :roll soft body ball
本文介绍了Box2d:滚动柔软的身体球的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我制作了一个柔软的球形int box2d,看起来像这样:
I made a soft body ball int box2d that looks like that:
圆的每个点都是box2d实体,每条线都是距离关节. 我该如何滚动?我不想改变世界重力而只是让它滚动,我希望它从中心开始旋转(不是每个圆点都独立).
Every point of the circle is a box2d body and every line is a distance joint. How can i roll it? I don't want to change the world gravity and just let it roll , I want it to start spinning from the center (not every circle point independent).
我只需要基本想法,而不是代码.
I just need the geeneral idea ,not code.
推荐答案
总体思路是向每个身体施加正确的力量.如果要旋转-这些力是从球的中心到身体的中心的法向矢量.
The general idea is to apply the right force to each body. If you want rotation - these forces are normals to the vectors from the center of the ball to the center of the body.
这篇关于Box2d:滚动柔软的身体球的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文