将一条线(边缘)设置为几乎 0 厚度的 box2d iphone 的主体
我正在尝试添加一条线作为 box2d 主体,厚度几乎为 0 或 1 像素。我尝试使用很多方法,如 setasedge、setasbox 但我无法得到它。
groundBox.SetAsEdge(b2Vec2([self x:256],[self y:0]), b2Vec2([self x:256],[self y:64]));
//groundBox.SetAsBox(0.01, 1.11, b2Vec2([self x:256],[self y:0]), 0.1);
groundBody->CreateFixture(&groundBox,0.1f);
对于 b2EdgeShape 显示它不存在。我将其包含在 box2d 参考 api 中。你能建议我画一条几乎为零厚度的线吗?
I am trying to add a line as box2d body for almost 0 or 1 pixel thickness.I tried to use lot of methods like setasedge,setasbox but i couldn't get it.
groundBox.SetAsEdge(b2Vec2([self x:256],[self y:0]), b2Vec2([self x:256],[self y:64]));
//groundBox.SetAsBox(0.01, 1.11, b2Vec2([self x:256],[self y:0]), 0.1);
groundBody->CreateFixture(&groundBox,0.1f);
and for b2EdgeShape is showing that it doesn't exist.I included as found in box2d reference api. Could you suggest me any idea to draw a line with almost null thickness.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不了解cocos2D本身,但我确信物理和显示是分离的。您可能想尝试找到 cocos2D 管理显示的位置并验证您的显卡是否能够显示细线(例如,对我来说更细的是 0.4):
顺便说一句,如果您的 cocos2D支持 Box2D 2.2,您可以尝试使用链对象而不是边,无论是否启用循环。
I don't know cocos2D itself, but I'm sure the physics and the display are dissociated. You might want to try to find where cocos2D manage the display and verify if your graphic card is able to display a thin line (eg. the thinner for me is 0.4) :
By the way, if your cocos2D supports Box2D 2.2, you could try a chain object instead of an edge, with loop enabled or not.