Actionscript 3 如何设置“世界刻度”和“x\y差”值以在物理实体和显示对象之间获得紧密匹配?

Actionscript 3 如何设置“世界刻度”和“x\y差”值以在物理实体和显示对象之间获得紧密匹配?,actionscript-3,box2d,scaling,starling-framework,Actionscript 3,Box2d,Scaling,Starling Framework,我在一个Starling应用程序中使用它,但我不明白如何将Box2D世界比例/中心轴与Starling屏幕匹配。例如: //I created a bodyDef here: bodyDef = new b2BodyDef(); //x\y_pos is the position on the screen where I want the body to stay bodyDef.position.Set(x_difference + x_pos/world_scale, y_differen

我在一个Starling应用程序中使用它,但我不明白如何将Box2D世界比例/中心轴与Starling屏幕匹配。例如:

//I created a bodyDef here:
bodyDef = new b2BodyDef();
//x\y_pos is the position on the screen where I want the body to stay
bodyDef.position.Set(x_difference + x_pos/world_scale, y_difference + y_pos/world_scale)

//Same for size...
//I created a shape here:
boxShape = new b2PolygonShape();
boxShape.SetAsBox(x_size/world_scale, y_size/world_scale);
如何设置world\u scale和x\y\u差值,以使身体和椋鸟显示对象之间接近匹配


在google上搜索时,我看到world\u scale=30,但为什么以及如何设置位置参考差x\y\u差?

比例完全取决于您,通常30表示Box2D world中的一米等于屏幕上的30点或像素。你只需要找出最适合你的方法,因为虚拟公制单位和像素/ppi/dpith之间没有标准化的转换,这就是我想知道的,作为答案。关于x\y\u差,测试,我看到它们为零。