A first attempt at overhauling collision. New everything.

--HG--
branch : box2d-update
This commit is contained in:
Bill Meltsner
2011-09-23 21:25:41 -04:00
parent 71abae06c7
commit 0678eac453
6 changed files with 203 additions and 79 deletions
+45 -22
View File
@@ -51,10 +51,7 @@ namespace box2d
// The Box2D contact.
b2Contact* contact;
// The parent world. Needed for scaling.
World * world;
public:
/**
@@ -63,23 +60,16 @@ namespace box2d
* data pointed to.
* @param point Pointer to the Box2D contact.
**/
Contact(World * world, const b2Contact * contact);
Contact(b2Contact * contact);
virtual ~Contact();
/**
* Gets the position of the Contact.
* Gets the position of each point of contact.
* @return The position along the x-axis.
* @return The position along the y-axis.
**/
int getPosition(lua_State * L);
/**
* Gets the linear impact velocity.
* @return The velocity along the x-axis.
* @return The velocity along the y-axis.
**/
int getVelocity(lua_State * L);
int getPositions(lua_State * L);
/**
* Gets the collision normal.
@@ -89,22 +79,55 @@ namespace box2d
int getNormal(lua_State * L);
/**
* How far apart the shapes are. If they are intersecting
* this value is negative.
**/
float getSeparation() const;
/**
* The mixed friction between the two shapes at
* The mixed friction between the two fixtures at
* the point of impact.
**/
float getFriction() const;
/**
* The mixed restitution of the two shapes
* The mixed restitution of the two fixtures
* at the point of impact.
**/
float getRestitution() const;
/**
* Check if the contact is enabled.
**/
bool isEnabled() const;
/**
* Check if the contact is touching.
**/
bool isTouching() const;
// Only call the setters in PreSolve
/**
* Override the default friction mixture.
**/
void setFriction(float friction);
/**
* Override the default restitution mixture.
**/
void setRestitution(float restitution);
/**
* Enable/disable this contact.
**/
void setEnabled(bool enabled);
/**
* Reset the friction mixture to the default
* value.
**/
void resetFriction();
/**
* Reset the restitution mixture to the default
* value.
**/
void resetRestitution();
};