Collision Shapes
// Physics collision shape. trs matrices are a special use of matrices where translation is stored in vector[0],
// rotation is stored in vector[1] and scale is stored in vector[3].
class RVAPI CollShape
{
public:
// Set collsion shape properties. [density] is the relative weight of the shape with a default of 1.
// [friction] range is 0=no friction 1=full friction. [restitution] range is 0=no bounce 1=full bounce.
// If [sensor] is true, shape reports collisions, but does not collide.
void SetProps(float density, float friction, float restitution, bool sensor = false);
// Internal.
void *operator () () const { return (void *)wobj; }
// Constructor.
CollShape(void *wobj);
// Destructor.
virtual ~CollShape();
private:
void *wobj;
};
// Sphere collision shape.
class RVAPI CollSphere : public CollShape
{
public:
// Construct sphere shape with translation, rotation, scale.
CollSphere(const M4f &trs);
// Destructor.
~CollSphere() override;
private:
byte wobj[192];
};
// Cube collision shape.
class RVAPI CollCube : public CollShape
{
public:
// Construct cube shape with translation, rotation, scale.
CollCube(const M4f &trs);
// Destructor.
~CollCube() override;
private:
byte wobj[192];
};
// Cone collision shape.
class RVAPI CollCone : public CollShape
{
public:
// Construct cone shape with translation, rotation, scale.
CollCone(const M4f &trs);
// Destructor.
~CollCone() override;
private:
byte wobj[192];
};
// Cylinder collision shape.
class RVAPI CollCylinder : public CollShape
{
public:
// Construct cylinder shape with translation, rotation, scale.
CollCylinder(const M4f &trs);
// Destructor.
~CollCylinder() override;
private:
byte wobj[192];
};
// Capsule collision shape.
class RVAPI CollCapsule : public CollShape
{
public:
// Construct capsule shape with translation, rotation, scale.
CollCapsule(const M4f &trs);
// Destructor.
~CollCapsule() override;
private:
byte wobj[192];
};
// Geometry collision mesh.
class RVAPI CollGeom : public CollShape
{
public:
// Construct geometry collision mesh with path to mesh file.
CollGeom(wcstr path);
// Destructor.
~CollGeom() override;
private:
byte wobj[256];
};