Wasabi
|
#include <WPhysicsComponent.hpp>
Public Member Functions | |
WPhysicsComponent (class Wasabi *app) | |
virtual WError | Initialize (bool debug=false)=0 |
virtual void | Cleanup ()=0 |
virtual void | Start ()=0 |
virtual void | Stop ()=0 |
virtual void | Step (float deltaTime)=0 |
virtual bool | Stepping () const =0 |
virtual WRigidBody * | CreateRigidBody (uint32_t ID=0) const =0 |
virtual bool | RayCast (WVector3 from, WVector3 to, W_RAYCAST_OUTPUT *out=nullptr)=0 |
virtual void | SetSpeed (float fSpeed)=0 |
virtual void | SetGravity (float x, float y, float z)=0 |
virtual void | SetGravity (WVector3 gravity)=0 |
Public Attributes | |
WRigidBodyManager * | RigidBodyManager |
Protected Attributes | |
class Wasabi * | m_app |
A physics component is a base class that can be derived to supply physics implementation for an application. A physics component provides an interface to manage the basic operations of a physics engine.
|
pure virtual |
Frees all resources allocated by the physics engine.
Implemented in WHavokPhysics, and WBulletPhysics.
|
pure virtual |
Creates a new rigid body instance. This is equivalent to calling new WRigidBody(app, ID), so care must be taken to free the resource when done with it.
ID | ID for the created rigid body |
Implemented in WBulletPhysics.
|
pure virtual |
Initializes the physics engine.
debug | If set to true, the physics will run in debug mode |
Implemented in WBulletPhysics.
|
pure virtual |
Performs a ray cast operation on the physics objects. A ray cast operation checks if a ray segment (given to the function) intersects any geometry, as far as the physics engine is concerned.
from | Starting point of the ray |
to | End point of the ray |
out | A pointer to a structure to be filled with extra output information |
Implemented in WBulletPhysics, and WHavokPhysics.
|
pure virtual |
Sets the physics gravity.
x | Gravity on the x-axis |
y | Gravity on the y-axis |
z | Gravity on the z-axis |
Implemented in WHavokPhysics, and WBulletPhysics.
|
pure virtual |
Sets the physics gravity.
gravity | Physics gravity vector |
Implemented in WHavokPhysics, and WBulletPhysics.
|
pure virtual |
Sets the simulation speed multiplier
fSpeed | Speed multiplier, must be > 0 (1 is normal speed) |
Implemented in WHavokPhysics, and WBulletPhysics.
|
pure virtual |
Start the physics simulation.
Implemented in WHavokPhysics, and WBulletPhysics.
|
pure virtual |
Step the physics simulation a certain time forward.
deltaTime | Time to step the simulation |
Implemented in WHavokPhysics, and WBulletPhysics.
|
pure virtual |
This function must return true if called during Step(), and false otherwise
Implemented in WHavokPhysics, and WBulletPhysics.
|
pure virtual |
Stop (pause) the physics simulation.
Implemented in WHavokPhysics, and WBulletPhysics.