简体   繁体   English

Box2d在更改和引擎解析后无法正常工作

[英]Box2d is working wierd after changing andengine resolution

i am having a really strange problem.. I have developing a game. 我遇到了一个非常奇怪的问题。我正在开发游戏。 I was using 480*800 camera resolution in andengine with 64*64pixel boxes with ptm=32 in box2d. 我在andengine中使用480 * 800摄像机分辨率,并且在box2d中使用ptm = 32的64 * 64像素框。

To have better graphics i increased the resolution to 720*1280. 为了获得更好的图形,我将分辨率提高到720 * 1280。 I replace all of my assets. 我替换了所有资产。 Now using a box with 96*96pixel. 现在使用一个96 * 96像素的盒子。

The problem is after increasing the resolution the physics behaviour changed. 问题是在提高分辨率后,物理行为发生了变化。 Its behaving wierd. 它的行为很奇怪。 Sometimes boxes are veeeery slowly sliding on each other althoug friction values are 1. Or they behave elasticly although restitution values are 0. And some swinging movements are converging. 有时,盒子在彼此之间缓慢滑动时,摩擦力值为1。或者,尽管恢复值为0,它们还是具有弹性表现。并且一些摆动运动正在收敛。 Rather than getting slowly and more stable they are getting stronger. 他们不是变得缓慢而稳定,而是变得更强大。

None of these problem exist when i am using 480*800 camera resolution 当我使用480 * 800相机分辨率时,这些问题都不存在

Please help me. 请帮我。 I am going crazy for a while about it now 我现在要为此疯了一段时间

Box2D manual says: Box2D手册说:

Box2D is tuned for MKS units. Box2D已针对MKS单位进行了调整。 Keep the size of moving objects roughly between 0.1 and 10 meters. 保持移动物体的大小大约在0.1至10米之间。 You'll need to use some scaling system when you render your environment and actors. 渲染环境和角色时,需要使用一些缩放系统。 The Box2D testbed does this by using an OpenGL viewport transform. Box2D测试平台通过使用OpenGL视口转换来实现此目的。 DO NOT USE PIXELS. 请勿使用像素。

So, check if size of your bodies in METERS, forget about pixels. 因此,请检查您的身体尺寸(以米为单位),而忽略像素。 Setup you ptm to match requirement, described in manual. 设置ptm以符合要求,如手册中所述。

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

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