20#ifndef YOURGAME_PHYSENV_H
21#define YOURGAME_PHYSENV_H
182 bool involves2(
const std::string &nameA,
const std::string &nameB)
const
222 bool newBoxShape(
const std::string &name,
float halfX,
float halfY,
float halfZ);
251 bool newConeShape(
const std::string &name,
float radius,
float height);
283 const std::string &shapeName,
348 std::unique_ptr<impl> pimpl;
Represents a Collision between two rigid bodies.
Definition physenv.h:148
bool involves2(const std::string &nameA, const std::string &nameB) const
Checks if this Collision happened between rigid bodies with names nameA and nameB.
Definition physenv.h:182
RigidBody * m_body1
Definition physenv.h:161
float m_impulse
Definition physenv.h:162
RigidBody * m_body0
Definition physenv.h:160
bool involves(const std::string &name) const
Checks if rigid body with name name is involved in this Collision.
Definition physenv.h:170
Collision(RigidBody *body0, RigidBody *body1, float impulse)
Constructor.
Definition physenv.h:157
Represents a Physical Environment.
Definition physenv.h:199
bool newRigidBody(const std::string &name, const std::string &shapeName, const yourgame::math::Trafo &trafo, const RigidBodyInfo &info)
Creates and stores a new rigid body.
bool newBoxShape(const std::string &name, float halfX, float halfY, float halfZ)
Creates and stores a new box shape to be referenced during rigid body creation.
bool deleteRigidBody(const std::string &name)
Deletes rigid body by name.
yourgame::util::RigidBody * getRigidBody(const std::string &name)
Returns rigid body by name.
std::vector< RigidBody * > getRigidBodiesStartingWith(const std::string &name)
Returns rigid bodies with names starting with name.
size_t clearRigidBodies()
Deletes all rigid bodies.
bool newCylinderShape(const std::string &name, float radius, float height)
Creates and stores a new cylinder shape to be referenced during rigid body creation.
bool newSphereShape(const std::string &name, float radius)
Creates and stores a new sphere shape to be referenced during rigid body creation.
bool newConeShape(const std::string &name, float radius, float height)
Creates and stores a new cone shape to be referenced during rigid body creation.
size_t numShapes()
Returns the number of present shapes.
void setGravity(float x, float y, float z)
Set the Gravity of the physical world.
RayTestResult rayTest(float eyeX, float eyeY, float eyeZ, float targetX, float targetY, float targetZ)
Shoots a ray from eye to target into the world. Result contains first rigid body hit,...
size_t clearShapes()
Deletes all shapes.
size_t numRigidBodies()
Returns the number of present rigid bodies.
bool deleteShape(const std::string &name)
Deletes a shape by name.
std::vector< Collision > getCollisions()
Returns the collisions of rigid bodies since last tick()
void tick(float dt)
Advances the physical world dt seconds.
Represents the result of a ray test.
Definition physenv.h:191
RayTestResult(RigidBody *rigidBody)
Definition physenv.h:193
RigidBody * m_rigidBody
Definition physenv.h:194
Represents a rigid body, holding a void pointer to an underlying implementation.
Definition physenv.h:49
yourgame::math::Trafo getTrafo()
Get transform (Trafo) calculated from rigid body.
RigidBody(std::string name, void *body)
Constructor.
Definition physenv.h:57
void setAngularFactor(float angFac)
Set the Angular Factor of the rigid body.
void applyCentralImpulse(float x, float y, float z)
Apply central impulse to the rigid body.
void setRestitution(float restitution)
Set the restitution of the rigid body.
void setTrafo(yourgame::math::Trafo trafo)
Set transform (Trafo) of rigid body.
void *const m_body
Definition physenv.h:143
void setSleepingThresholds(float linear, float angular)
Set the Sleeping Thresholds of the rigid body.
void setAngularFactors(float x, float y, float z)
Set the Angular Factors (x,y,z) of the rigid body.
void applyCentralForce(float x, float y, float z)
Apply central force to the rigid body.
void setFriction(float friction)
Set the friction of the rigid body.
std::string m_name
Definition physenv.h:142
void setLinearFactors(float x, float y, float z)
Set the Linear Factors (x,y,z) of the rigid body.
float linearSleepingThreshold
Definition physenv.h:41
float spinningFriction
Definition physenv.h:39
float angularSleepingThreshold
Definition physenv.h:42
float friction
Definition physenv.h:37
float restitution
Definition physenv.h:40
float angularDamping
Definition physenv.h:36
float linearDamping
Definition physenv.h:35
float mass
Definition physenv.h:34
bool kinematic
Definition physenv.h:43
float rollingFriction
Definition physenv.h:38
bool disableDeactivation
Definition physenv.h:44