YourGameLib
|
Represents a Physical Environment. More...
#include <physenv.h>
Public Member Functions | |
PhysEnv () | |
~PhysEnv () | |
void | setGravity (float x, float y, float z) |
Set the Gravity of the physical world. | |
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 | newSphereShape (const std::string &name, float radius) |
Creates and stores a new sphere shape to be referenced during rigid body creation. | |
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 | newConeShape (const std::string &name, float radius, float height) |
Creates and stores a new cone shape to be referenced during rigid body creation. | |
bool | deleteShape (const std::string &name) |
Deletes a shape by name. | |
size_t | clearShapes () |
Deletes all shapes. | |
size_t | numShapes () |
Returns the number of present shapes. | |
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 | 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. | |
size_t | numRigidBodies () |
Returns the number of present rigid bodies. | |
void | tick (float dt) |
Advances the physical world dt seconds. | |
std::vector< Collision > | getCollisions () |
Returns the collisions of rigid bodies since last tick() | |
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, if any. | |
Represents a Physical Environment.
yourgame::util::PhysEnv::PhysEnv | ( | ) |
yourgame::util::PhysEnv::~PhysEnv | ( | ) |
size_t yourgame::util::PhysEnv::clearRigidBodies | ( | ) |
Deletes all rigid bodies.
size_t yourgame::util::PhysEnv::clearShapes | ( | ) |
Deletes all shapes.
bool yourgame::util::PhysEnv::deleteRigidBody | ( | const std::string & | name | ) |
Deletes rigid body by name.
name | name of the rigidy body to delete |
bool yourgame::util::PhysEnv::deleteShape | ( | const std::string & | name | ) |
Deletes a shape by name.
name | name of shape to delete |
std::vector< Collision > yourgame::util::PhysEnv::getCollisions | ( | ) |
Returns the collisions of rigid bodies since last tick()
std::vector< RigidBody * > yourgame::util::PhysEnv::getRigidBodiesStartingWith | ( | const std::string & | name | ) |
Returns rigid bodies with names starting with name.
name | name (prefix) of rigid bodies to get |
yourgame::util::RigidBody * yourgame::util::PhysEnv::getRigidBody | ( | const std::string & | name | ) |
Returns rigid body by name.
name | name of the rigid body |
bool yourgame::util::PhysEnv::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.
name | name of the new box shape |
halfX | half extent in x dimension |
halfY | half extent in y dimension |
halfZ | half extent in z dimension |
bool yourgame::util::PhysEnv::newConeShape | ( | const std::string & | name, |
float | radius, | ||
float | height | ||
) |
Creates and stores a new cone shape to be referenced during rigid body creation.
name | name of the new cone shape |
radius | radius |
height | height |
bool yourgame::util::PhysEnv::newCylinderShape | ( | const std::string & | name, |
float | radius, | ||
float | height | ||
) |
Creates and stores a new cylinder shape to be referenced during rigid body creation.
name | name of the new cylinder shape |
radius | radius |
height | height |
bool yourgame::util::PhysEnv::newRigidBody | ( | const std::string & | name, |
const std::string & | shapeName, | ||
const yourgame::math::Trafo & | trafo, | ||
const RigidBodyInfo & | info | ||
) |
Creates and stores a new rigid body.
name | name of the rigid body |
shapeName | name of the shape to use for this rigid body |
bool yourgame::util::PhysEnv::newSphereShape | ( | const std::string & | name, |
float | radius | ||
) |
Creates and stores a new sphere shape to be referenced during rigid body creation.
name | name of the new sphere shape |
radius | radius |
size_t yourgame::util::PhysEnv::numRigidBodies | ( | ) |
Returns the number of present rigid bodies.
size_t yourgame::util::PhysEnv::numShapes | ( | ) |
Returns the number of present shapes.
RayTestResult yourgame::util::PhysEnv::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, if any.
void yourgame::util::PhysEnv::setGravity | ( | float | x, |
float | y, | ||
float | z | ||
) |
Set the Gravity of the physical world.
x | x-component of gravity |
y | y-component of gravity |
z | z-component of gravity |
void yourgame::util::PhysEnv::tick | ( | float | dt | ) |
Advances the physical world dt seconds.
dt | time [seconds] to advance the physical world |