Gravity
Gravity is automatically built into the world.Gravity is a vertically downward vector.
Impulse
Impulse is force applied at a moment in time.Vec2 impulse = new Vec2(2,4); // 2-right, 4-down
box.applyImpulse(impulse, box.getWorldCenter());
Designing the Catapult Implementation
Impulse
I = C(catapult - ball)Vec2 impulse = new Vec2();
impulse.set(catapultPos);
impulse = impulse.sub(boid.getWorldCenter());
impulse = impulse.mul(200);
Collisions are handled by the physics engine.
- The key knowledge is to know when a collision happened
Collision handler function
void collision(Body b1, Body b2, float impulse) {// collision response goes here
}
No comments:
Post a Comment