@Override
public PhysicsEnvironment2D<PhysicsAgent2D<?>>[] generateRunnables(ParCollection params) {
@SuppressWarnings("unchecked")
PhysicsEnvironment2D<PhysicsAgent2D<?>>[] envs = new PhysicsEnvironment2D[1];
PhysicsEnvironment2D<PhysicsAgent2D<?>> env = new PhysicsEnvironment2D<PhysicsAgent2D<?>>(0, params, new Vector2f(0, 0), 500);
envs[0] = env;
for (int i = 0; i < 200; i += 30) {
for (int j = 0; j < 200; j += 30) {
env.addAgent(new PhysicsAgent2(j * 10 + i, env, 5, params), new Vector2D(i, j), 0);
}
}
PhysicsAgent3 p = new PhysicsAgent3(10000, env, 200, params);
env.addAgent(p, new Vector2D(-200, 100), 0);
// p.adjustVelocity(new Vector2f(100, 0));
env.addAgent(new StaticBody(10001, env, params), new Vector2D(10, -80), 0);
env.addAgent(new StaticBody(10002, env, params), new Vector2D(125, -80), 0);
env.addAgent(new StaticBody(10003, env, params), new Vector2D(250, -80), 0);
env.addAgent(new StaticBody(10004, env, params), new Vector2D(10, 250), 0);
env.addAgent(new StaticBody(10005, env, params), new Vector2D(125, 250), 0);
env.addAgent(new StaticBody(10006, env, params), new Vector2D(250, 250), 0);
env.addAgent(new StaticBody(10007, env, params), new Vector2D(325, -40), 90);
env.addAgent(new StaticBody(10008, env, params), new Vector2D(325, 85), 90);
env.addAgent(new StaticBody(10009, env, params), new Vector2D(325, 210), 90);
env.add(new ForceSource<PhysicsAgent2D<?>>() {
private static final long serialVersionUID = 7669888473552046204L;
@Override
public void apply(PhysicsAgent2D<?> body, float dt) {
if (body.id() == 10000) {
body.addForce(new Vector2f(3500, -150));
}
}
});
return envs;