Changes

Jump to: navigation, search

Team Guardian Physics

2,112 bytes added, 04:12, 6 April 2011
PhysicsFrame
==== PhysicsFrame ====
 
A PhysicsFrame is a convenience class that internally holds an instance of a RigidBody. This can be useful in that it is manipulated just like any other Frame and direct interaction with RBDynamics struct is not strictly required. Let's examine the interface:
 
<pre>
/* Physics Frame Interface - Model Branch
*
* iPhysicsFrame.h
* March 22 2011
* distributed under TPL - see ../Licenses.txt
* Hasan Kamal-Al-Deen
*/
 
#include "Frame.h"
 
//--------------------------- iPhysicsFrame -----------------------------------
//
// iPhysicsFrame is the Interface to the PhysicsFrame object.
//
 
class iRigidBody;
struct RBDynamics;
 
class iPhysicsFrame : public Frame {
public:
virtual iRigidBody* getRB() const = 0;
virtual RBDynamics* getDynamics() const = 0;
virtual iPhysicsFrame* clone() const = 0;
// termination functions
virtual void suspend() const = 0;
virtual void release() const = 0;
virtual void Delete() const = 0;
};
 
extern "C"
iPhysicsFrame* CreatePhysicsFrame();
</pre>
 
The standard suite of iFrame functions is implemented to work as you would expect. Let's look at the new convenience functions:
<pre>
virtual iRigidBody* getRB() const = 0;
virtual RBDynamics* getDynamics() const = 0;
</pre>
; virtual iRigidBody* getRB() const : Returns the RigidBody instance associated with this PhysicsFrame.
; virtual RBDynamics* getDynamics() const : Returns the RBDynamics instance contained within the associated RigidBody.
 
It should be noted that while PhysicsScene tracks all RigidBodies and destroys them upon engine shutdown, it does not do this for PhysicsFrame instances. Therefore, the implementer is responsible (at least for the time being!) for destrying PhysicsFrame instances. Please refer to the example implementation for an example on how to do this.
=== Collision ===

Navigation menu