问题标签 [box2d-iphone]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
box2d - Box 2D - 有没有办法将地面 b2EdgeShape 向上移动
我正在开发一款 iPhone 游戏,地面是一个长而重复的矩形精灵对象,它在屏幕底部上方延伸约 30 像素。我正在尝试将我的地面边缘形状对齐 30 像素,以便当玩家精灵从跳跃降落在地面上时,他将降落在地面图像的顶部。当我尝试添加以下代码时,它不起作用:
我意识到我可以使用矩形作为地面,但由于我的玩家精灵只与图像的顶部发生碰撞,我宁愿使用边缘形状。
iphone - 想要在 cocos2d 和 box2d 应用程序中的球碰撞上显示标签
我正在使用 _world->step(dt,5,5) 来检测碰撞系统。所以碰撞实际上是由 box2d 类处理的。现在我想根据它碰撞到哪个球来显示球碰撞的分数?
有人可以帮我解决这个问题吗?如果你们愿意,如果需要,我可以提供滴答函数的源代码。
感谢您的帮助。
谢谢,
安基塔
iphone - iphone box2d游戏应用分屏两部分
这个概念就像我有 10 个球,一个一个球应该在中间,所以我可以对它做一些动作,剩下的球应该显示在底部。但我不能把我的屏幕分成两部分来把球放在底部。我基本上想在底部显示所有剩余的球,它不应该碰撞或任何它只是一个显示。
我有用于创建游戏的 CCColorLayer 扩展类。
任何人都可以帮我吗?
谢谢,
安基塔
iphone - 鼠标关节无法将球限制在屏幕的一半
大家好,我正在使用 box 2d 框架在 cocoas2d 中开发应用程序,但不幸的是
我无法将灰色球限制在此处显示的图像的半屏幕区域中我希望该球不要进入屏幕的对面部分
我已经使用 b2Mousejoint 来在屏幕上移动球
b2PrismaticJointDef 限制任何特定轴但
我想限制屏幕的特定矩形区域
ios - cocos2d, box2d and retina mode: give up, or try to get it to work?
I've been trying to get my box2d game to work in retina mode, and I'm running into a lot of irritating issues when running in higher-resolution mode.
cocos2d renders my graphics correctly in retina mode, but I'm finding the need for hack after hack to get box2d to work the same as in lower-resolution mode. For example, I'm finding I need to do something like this to get the debug draw shape size correct in retina mode:
That hack (adjusting all vertex points by CC_CONTENT_SCALE_FACTOR()
), of course inevitably leads to a density hack, to keep movement similar to lower-resolution mode:
And that leads to another adjustment hack when applying forces:
Keep in mind, I'm drawing in debug mode by scaling my debug draw calls, like so:
What is it that I'm fundamentally misunderstanding about getting box2d to work with retina mode? I'm using Steffen Itterheim's suggested Box2DHelper class in place of PTM_RATIO
, but that just doesn't seem to be enough. Any ideas? I'm about to give up entirely on retina mode for my game at this point.
iphone - 如何在box2d中实现水平滚动?
我正在使用 box2D 开发 iPhone 游戏,我需要实现水平滚动……我能够滚动背景纹理等等……但是,问题是,我无法滚动物理世界box2d ...请帮助我,如何移动box2d世界...我没有使用cocos2d ...我搜索了很多,但是没有cocos2d找不到任何解决方案...
问候,
苏然
cocos2d-iphone - Box2d Loop Shape,确定平稳着陆
我正在编写一个游戏,其中一个圆形落在由几百个顶点组成的 b2LoopShape 上。
我正在尝试通过使用接触侦听器来确定我的着陆是否平滑(沿边缘着陆或垂直于边缘着陆),但无法正确。
有任何想法吗?
iphone - 如何在 COCOS2D 中实现挥动(如钟摆)绳索效果?
当任何东西碰到悬挂物体时,我正在尝试实现波浪效果,我怎样才能实现两者,:
1.将一个物体挂在空中(因为它是一个会波动的动态物体)
2.对该身体实施挥动效果
谢谢你
iphone - 物体动作太慢
在 cocos2d 环境和 box2D 中,当一个球形物体落在一个钝的倾斜障碍物上时,它的移动非常缓慢,如果你已经编码为在物体运动时不与世界进行任何交互,那真是令人作呕。有什么办法可以摆脱物体的这种慢动作吗?
iphone - 在移动场景中实现静态对象
如何实现一个似乎粘在其位置上的“菜单”?在这里卡住我的意思是说要么scene
正在移动,要么仍然保持在原位。这给人的感觉就像它就在它的位置上。我通过滚动场景移动它来实现它,它可以工作但行为很荒谬,“有时”。
这是我如何创建的代码menu
:
现在移动场景的代码(当用户试图滚动场景时)。我还用 移动了菜单scene
,所以它的效果是菜单仍然是scene
: