我遇到了问题,我尝试了所有可能的组合。我试图让我的球尽可能快地飞出屏幕。唯一的问题是无论我设置什么值,它都会以相同的速度移动。我试着做 ballBody.SetLinearVelocity(new Vector2(1000000f, 0));
ballBody.SetLinearVelocity(new Vector2(10f, 0));
中间的每一个数字,球仍然以相同的速度移动。我到底做错了什么。正文的代码也在下面。我想要的只是让球跑得非常快,就像弹球机一样。
var bodyDef = new BodyDef();
bodyDef.position = new Vector2(400, 200);
bodyDef.type = BodyType.Dynamic;
bodyDef.fixedRotation = true;
ballBody = world.CreateBody(bodyDef);
var circleShape = new CircleShape();
circleShape._radius = 12.5f;
var fixtureDef = new FixtureDef();
fixtureDef.restitution = 1.4f;
fixtureDef.shape = circleShape;
fixtureDef.friction = 0;
ballBody.CreateFixture(fixtureDef);