Closed H1rono closed 3 years ago
サンプルコード:
World world; void setup() { size(720, 720); // World(gravity, air_resistance, delta_time) world = new World(new PVector(0, 10), 0, 0.05); // Box(position, velocity, mass, w_len, h_len) // Box1 world.add_obj(new Box(new PVector(100, 560), new PVector(0, 0), 100, 60, 40)); // Box2 world.add_obj(new Box(new PVector(130, 539), new PVector(0, 0), 10, 30, 20)); // Floor(height) world.add_obj(new Floor(600)); } /* +------------------+ | | Box1 | | +------------------+ +--------------------------+ | | | | | | Box2 | | +--------------------------+ ------------------------------------ Floor */ void draw() { background(255); world.reset_gravity(); world.calc_collide(); world.update(); world.draw(); }
Worldなどのクラスはこのコミットのものです。 このプログラムを実行すると、Box1がBox2にめりこんでしまいます。
World
Box1
Box2
サンプルコード:
World
などのクラスはこのコミットのものです。 このプログラムを実行すると、Box1
がBox2
にめりこんでしまいます。