--- a/src/PhysicsObject.cc Mon Dec 08 11:10:04 2008 +0000
+++ b/src/PhysicsObject.cc Mon Dec 08 12:02:20 2008 +0000
@@ -7,8 +7,18 @@
PhysicsObject::PhysicsObject (PhysicsWorld &world, float mass, Vector position, Vector velocity, ObjectType type,
float collision_elasticity, bool enabled) :
- world(world), position(position), velocity(velocity), mass(mass), inAir(true), aim(0), facing(FACING_RIGHT),
- alive(false), shouldDelete(false), type(type), pivot(NULL), collision_elasticity(collision_elasticity)
+ world(world),
+ position(position),
+ velocity(velocity),
+ mass(mass),
+ inAir(true),
+ collision_elasticity(collision_elasticity),
+ aim(0),
+ facing(FACING_RIGHT),
+ alive(false),
+ shouldDelete(false),
+ type(type),
+ pivot(NULL)
{
if (enabled)
enable();
@@ -152,7 +162,7 @@
// If, however, there's a force caused by a bomb, e.g., set it in air.
// Still, we have to be able to separate forces caused by walking attempts
// and bombs etc (+0.1 because float comparison can be dangerous)
- if (total.y < 0.01 || abs(total.x) > PLAYER_MOVE_FORCE + 0.1)
+ if (total.y < 0.01 || fabs(total.x) > PLAYER_MOVE_FORCE + 0.1)
this->inAir = true;
}
@@ -270,8 +280,8 @@
velAfterTick = velocity;
Derivative tmpd;
Derivative k1 = evaluate(force, 0, tmpd, posAfterTick, velAfterTick);
- Derivative k2 = evaluate(force, 0.5f*dt, k1, posAfterTick, velAfterTick);
- Derivative k3 = evaluate(force, 0.5f*dt, k2, posAfterTick, velAfterTick);
+ Derivative k2 = evaluate(force, dt / 2, k1, posAfterTick, velAfterTick);
+ Derivative k3 = evaluate(force, dt / 2, k2, posAfterTick, velAfterTick);
Derivative k4 = evaluate(force, dt, k3, posAfterTick, velAfterTick);
@@ -404,6 +414,8 @@
}
float PhysicsObject::getPivotForce (PhysicsObject *bob) {
+ (void) bob;
+
return 0.0;
}
@@ -426,6 +438,11 @@
}
return true;
}
+
+void PhysicsObject::onCollision (Vector collisionPoint, PhysicsObject *other) {
+ (void) collisionPoint;
+ (void) other;
+}
int8_t crossProduct (const Vector &p1, const Vector &p2, const Vector &p3) {
float p = (p2.x - p1.x)*(p3.y - p1.y) - (p2.y - p1.y)*(p3.x - p1.x);