improve segment vs segment collision, small fixes
This commit is contained in:
@ -32,6 +32,15 @@ struct b3Color
|
||||
float32 r, g, b, a;
|
||||
};
|
||||
|
||||
// Color pallete commonly used by the debug draw interface.
|
||||
extern const b3Color b3Color_black;
|
||||
extern const b3Color b3Color_white;
|
||||
extern const b3Color b3Color_red;
|
||||
extern const b3Color b3Color_green;
|
||||
extern const b3Color b3Color_blue;
|
||||
extern const b3Color b3Color_yellow;
|
||||
extern const b3Color b3Color_pink;
|
||||
|
||||
// Implement this interface and set to a world so it can draw the physics entities.
|
||||
class b3Draw
|
||||
{
|
||||
|
@ -34,6 +34,14 @@ class b3ContactListener;
|
||||
class b3ContactFilter;
|
||||
class b3Draw;
|
||||
|
||||
struct b3RayCastSingleOutput
|
||||
{
|
||||
b3Shape* shape; // shape
|
||||
b3Vec3 point; // intersection point on surface
|
||||
b3Vec3 normal; // surface normal of intersection
|
||||
float32 fraction; // time of intersection on segment
|
||||
};
|
||||
|
||||
// Use a physics world to create/destroy rigid bodies, execute ray cast and volume queries.
|
||||
class b3World
|
||||
{
|
||||
@ -83,6 +91,13 @@ public:
|
||||
// and the number of constraint solver iterations.
|
||||
void Step(float32 dt, u32 velocityIterations, u32 positionIterations);
|
||||
|
||||
// Perform a ray cast with the world.
|
||||
// If the ray doesn't intersect with a shape in the world then return false.
|
||||
// The ray cast output is the intercepted shape, the intersection
|
||||
// point in world space, the face normal on the shape associated with the point,
|
||||
// and the intersection fraction.
|
||||
bool RayCastSingle(b3RayCastSingleOutput* output, const b3Vec3& p1, const b3Vec3& p2) const;
|
||||
|
||||
// Perform a ray cast with the world.
|
||||
// The given ray cast listener will be notified when a ray intersects a shape
|
||||
// in the world.
|
||||
@ -91,13 +106,6 @@ public:
|
||||
// and the intersection fraction.
|
||||
void RayCast(b3RayCastListener* listener, const b3Vec3& p1, const b3Vec3& p2) const;
|
||||
|
||||
// Convenience function.
|
||||
// Perform a ray cast with the world.
|
||||
// If there is an intersection then the given ray cast listener will be notified once with
|
||||
// the shape closest to the ray origin and the associated ray cast output.
|
||||
// @todo Centralize all queries to a common scene query class?
|
||||
void RayCastFirst(b3RayCastListener* listener, const b3Vec3& p1, const b3Vec3& p2) const;
|
||||
|
||||
// Perform a AABB cast with the world.
|
||||
// The query listener will be notified when two shape AABBs are overlapping.
|
||||
// If the listener returns false then the query is stopped immediately.
|
||||
|
Reference in New Issue
Block a user