mirror of
https://github.com/love2d/love.git
synced 2026-08-18 03:34:23 +02:00
A first attempt at overhauling collision. New everything.
--HG-- branch : box2d-update
This commit is contained in:
@@ -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();
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user