简体   繁体   English

Box2d为动态车身创造易碎关节

[英]Box2d create breakable joints for dynamic body

Have been working on building a Bridge builder using box2d. 一直在使用box2d构建Bridge构建器。

Basically you build a bridge and stress test it by passing objects on top of it. 基本上你构建一个桥梁并通过在它上面传递对象来对它进行压力测试。 The joints break if the stress applied is high. 如果施加的应力很高,则关节会断裂。

Can you please help how best to join the b2Body. 能否帮助您了解如何最好地加入b2Body。 Have tried revolute joint, but they are not breaking. 尝试了旋转关节,但他们没有打破。 Any suggestions. 有什么建议。

Thanks 谢谢

"You can get the reaction force and torque off the joint. You can query these forces after each time step and destroy the joint when your threshold is exceeded." “你可以从关节获得反作用力和扭矩。你可以在每个时间步后查询这些力,并在超过你的阈值时摧毁关节。” - Quote from Erin Catto - http://www.box2d.org/forum/viewtopic.php?f=3&t=1079 - 来自Erin Catto的报价 - http://www.box2d.org/forum/viewtopic.php?f=3&t=1079

I think the joints will not break by themselves. 我认为关节不会自行打破。 You have to break them using DestroyJoint function. 你必须使用DestroyJoint函数来打破它们。 You can setup b2ContactListener and get the impulse velocity of the object that hits your bridge and you can take the decision if you want to break the joint or not. 您可以设置b2ContactListener并获取撞击桥梁的物体的冲击速度,如果您想要破坏关节,您可以做出决定。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM