40 #ifndef _ghostproxy_cpp
41 #define _ghostproxy_cpp
43 #include "Physics/ghostproxy.h"
44 #include "Physics/physicsmanager.h"
47 #include "stringtool.h"
49 #include <btBulletDynamicsCommon.h>
50 #include <BulletSoftBody/btSoftRigidDynamicsWorld.h>
51 #include <BulletCollision/CollisionDispatch/btGhostObject.h>
59 PhysicsGhostBody(NULL)
66 PhysicsGhostBody(NULL)
74 PhysicsGhostBody(NULL)
100 return Mezzanine::PT_Physics_GhostProxy;
122 btCollisionObject* OverlappingObject = this->
PhysicsGhostBody->getOverlappingObject( static_cast<int>( Index ) );
123 return static_cast<CollidableProxy*
>( OverlappingObject->getUserPointer() );
135 btBroadphasePairArray& PairArray = this->
PhysicsGhostBody->getOverlappingPairCache()->getOverlappingPairArray();
136 const btBroadphasePair& CachePair = PairArray[Index];
137 btBroadphasePair* WorldPair = PhysWorld->getPairCache()->findPair(CachePair.m_pProxy0,CachePair.m_pProxy1);
139 if( WorldPair != NULL )
141 btManifoldArray ManifoldArray;
142 ManifoldArray.clear();
144 if( WorldPair->m_algorithm )
145 WorldPair->m_algorithm->getAllContactManifolds(ManifoldArray);
147 for(
int ManifoldIndex = 0 ; ManifoldIndex < ManifoldArray.size() ; ++ManifoldIndex )
149 btPersistentManifold* Manifold = ManifoldArray[ManifoldIndex];
150 for(
int ContactIndex = 0 ; ContactIndex < Manifold->getNumContacts() ; ++ContactIndex )
156 btCollisionObject* ColObj = ( Manifold->getBody0() != this->
PhysicsGhostBody ? (btCollisionObject*)(Manifold->getBody0()) : (btCollisionObject*)(Manifold->getBody1()) );
166 btBroadphasePairArray& PairArray = this->
PhysicsGhostBody->getOverlappingPairCache()->getOverlappingPairArray();
167 return static_cast<UInt32>( PairArray.size() );
183 {
return "GhostProxy"; }
This is the base class for all collision shapes.
virtual void AddToWorld()
Performs all the necessary task to ensure this object is connected to it's respective world and ready...
virtual UInt32 GetNumShapeOverlappingProxies() const
Gets the number of proxies overlapping with the actual collision shape of this ghost.
virtual btPairCachingGhostObject * _GetPhysicsObject() const
Accessor for the internal ghost body physics proxy.
virtual UInt32 GetNumAABBOverlappingProxies() const
Gets the number of proxies overlapping with the AABB of this ghost.
PhysicsManager * Manager
This is a pointer to the physics manager that created and owns this proxy.
virtual void ProtoSerializeProperties(XML::Node &SelfRoot) const
Convert the properties of this class to an XML::Node ready for serialization.
virtual void ProtoDeSerialize(const XML::Node &SelfRoot)
Take the data stored in an XML Node and overwrite this object with it.
virtual CollidableProxy * GetShapeOverlappingProxy(const UInt32 Index)
Gets a proxy overlapping with the collision shape of this ghost.
virtual void ProtoDeSerializeProperties(const XML::Node &SelfRoot)
Take the data stored in an XML Node and overwrite the properties of this object with it...
Any global enumerations shared between multiple classes is to be declared here.
virtual String GetDerivedSerializableName() const
Gets the most derived serializable name of this WorldProxy.
static String GetSerializableName()
Get the name of the the XML tag the proxy class will leave behind as its instances are serialized...
btPairCachingGhostObject * PhysicsGhostBody
GhostBody proxy used by the internal physics.
Int16 CollisionGroup
The classifications pertaining to this object in regards to collisions.
A light-weight handle for manipulating nodes in DOM tree.
ProxyType
Used by all World proxies to describe what their derived types are.
uint32_t UInt32
An 32-bit unsigned integer.
virtual Mezzanine::ProxyType GetProxyType() const
Accessor for the type of proxy.
virtual void CreateGhostObject()
Used to create the physics representation of the ghost body.
virtual ~GhostProxy()
Class destructor.
btSoftRigidDynamicsWorld * _GetPhysicsWorldPointer()
This returns a pointer to the bullet physics world. This is for internal use only.
virtual CollidableProxy * GetAABBOverlappingProxy(const UInt32 Index)
Gets a proxy overlapping with the AABB of this ghost.
This is a proxy from which physics objects that can collide with each other are handled.
virtual void RemoveFromWorld()
Unhooks this proxy from it's respective world.
This is simply a place for storing all the Physics Related functions.
virtual btCollisionObject * _GetBasePhysicsObject() const
Accessor for the internal physics object.
The bulk of the engine components go in this namspace.
virtual Boole IsInWorld() const
Gets whether or not this object is inside of it's world.
Int16 CollisionMask
Stores the kind of World Objects that can collide with each other.
virtual void SetCollisionShape(CollisionShape *Shape)
Sets the collision shape to be used.
virtual void ProtoSerializeProperties(XML::Node &SelfRoot) const
Convert the properties of this class to an XML::Node ready for serialization.
std::string String
A datatype used to a series of characters.
GhostProxy(const UInt32 ID, PhysicsManager *Creator)
Class constructor.
virtual void ProtoDeSerializeProperties(const XML::Node &SelfRoot)
Take the data stored in an XML Node and overwrite the properties of this object with it...