btPlayer.h
Engine/source/T3D/physics/bullet/btPlayer.h
Classes:
class
Detailed Description
1 2//----------------------------------------------------------------------------- 3// Copyright (c) 2012 GarageGames, LLC 4// 5// Permission is hereby granted, free of charge, to any person obtaining a copy 6// of this software and associated documentation files (the "Software"), to 7// deal in the Software without restriction, including without limitation the 8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 9// sell copies of the Software, and to permit persons to whom the Software is 10// furnished to do so, subject to the following conditions: 11// 12// The above copyright notice and this permission notice shall be included in 13// all copies or substantial portions of the Software. 14// 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21// IN THE SOFTWARE. 22//----------------------------------------------------------------------------- 23 24#ifndef _BTPLAYER_H 25#define _BTPLAYER_H 26 27#ifndef _T3D_PHYSICS_PHYSICSPLAYER_H_ 28#include "T3D/physics/physicsPlayer.h" 29#endif 30 31 32class BtWorld; 33//class btKinematicCharacterController; 34class btPairCachingGhostObject; 35class btConvexShape; 36class btVector3; 37 38 39class BtPlayer : public PhysicsPlayer 40{ 41protected: 42 43 //F32 mSkinWidth; 44 45 BtWorld *mWorld; 46 47 SceneObject *mObject; 48 49 /// 50 //btKinematicCharacterController *mController; 51 52 /// 53 btPairCachingGhostObject *mGhostObject; 54 55 /// 56 btConvexShape *mColShape; 57 58 /// 59 F32 mOriginOffset; 60 61 /// 62 F32 mSlopeAngle; 63 /// 64 65 /// 66 F32 mStepHeight; 67 /// 68 void _releaseController(); 69 70 /// 71 bool _recoverFromPenetration(); 72 73 /// 74 bool _sweep( btVector3 *inOutCurrPos, const btVector3 &disp, CollisionList *outCol ); 75 76 /// 77 void _stepForward( btVector3 *inOutCurrPos, const btVector3 &displacement, CollisionList *outCol ); 78 79public: 80 81 BtPlayer(); 82 virtual ~BtPlayer(); 83 84 // PhysicsObject 85 virtual PhysicsWorld* getWorld(); 86 virtual void setTransform( const MatrixF &transform ); 87 virtual MatrixF& getTransform( MatrixF *outMatrix ); 88 virtual void setScale( const Point3F &scale ); 89 virtual Box3F getWorldBounds() { return Box3F::Invalid; } 90 virtual void setSimulationEnabled( bool enabled ) {} 91 virtual bool isSimulationEnabled() { return true; } 92 93 // PhysicsPlayer 94 virtual void init( const char *type, 95 const Point3F &size, 96 F32 runSurfaceCos, 97 F32 stepHeight, 98 SceneObject *obj, 99 PhysicsWorld *world ); 100 virtual Point3F move( const VectorF &displacement, CollisionList &outCol ); 101 virtual void findContact( SceneObject **contactObject, VectorF *contactNormal, Vector<SceneObject*> *outOverlapObjects ) const; 102 virtual bool testSpacials( const Point3F &nPos, const Point3F &nSize ) const { return true; } 103 virtual void setSpacials( const Point3F &nPos, const Point3F &nSize ) {} 104 virtual void enableCollision(); 105 virtual void disableCollision(); 106}; 107 108 109#endif // _BTPLAYER_H 110