Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 8, 2009, 12:58:47 AM (16 years ago)
Author:
dafrick
Message:

Reverted to revision 2906 (because I'm too stupid to merge correctly, 2nd try will follow shortly. ;))

Location:
code/branches/questsystem5
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/questsystem5

  • code/branches/questsystem5/src/bullet/BulletDynamics/Character/btCharacterControllerInterface.h

    r2907 r2908  
    1818
    1919#include "LinearMath/btVector3.h"
    20 #include "BulletDynamics/Dynamics/btActionInterface.h"
    2120
    2221class btCollisionShape;
     
    2423class btCollisionWorld;
    2524
    26 class btCharacterControllerInterface : public btActionInterface
     25class btCharacterControllerInterface
    2726{
    2827public:
  • code/branches/questsystem5/src/bullet/BulletDynamics/Character/btKinematicCharacterController.cpp

    r2907 r2908  
    2323#include "btKinematicCharacterController.h"
    2424
    25 static btVector3 upAxisDirection[3] = { btVector3(1.0f, 0.0f, 0.0f), btVector3(0.0f, 1.0f, 0.0f), btVector3(0.0f, 0.0f, 1.0f) };
    26 
    2725///@todo Interact with dynamic objects,
    2826///Ride kinematicly animated platforms properly
     
    9694}
    9795
    98 btKinematicCharacterController::btKinematicCharacterController (btPairCachingGhostObject* ghostObject,btConvexShape* convexShape,btScalar stepHeight, int upAxis)
    99 {
    100         m_upAxis = upAxis;
     96btKinematicCharacterController::btKinematicCharacterController (btPairCachingGhostObject* ghostObject,btConvexShape* convexShape,btScalar stepHeight)
     97{
    10198        m_addedMargin = 0.02f;
    10299        m_walkDirection.setValue(0,0,0);
     
    105102        m_stepHeight = stepHeight;
    106103        m_turnAngle = btScalar(0.0);
    107         m_convexShape=convexShape;     
     104        m_convexShape=convexShape;
     105       
    108106}
    109107
     
    112110}
    113111
     112
    114113btPairCachingGhostObject* btKinematicCharacterController::getGhostObject()
    115114{
     
    117116}
    118117
    119 bool btKinematicCharacterController::recoverFromPenetration ( btCollisionWorld* collisionWorld)
     118bool btKinematicCharacterController::recoverFromPenetration (btCollisionWorld* collisionWorld)
    120119{
    121120
     
    174173        // phase 1: up
    175174        btTransform start, end;
    176         m_targetPosition = m_currentPosition + upAxisDirection[m_upAxis] * m_stepHeight;
     175        m_targetPosition = m_currentPosition + btVector3 (btScalar(0.0), m_stepHeight, btScalar(0.0));
    177176
    178177        start.setIdentity ();
     
    180179
    181180        /* FIXME: Handle penetration properly */
    182         start.setOrigin (m_currentPosition + upAxisDirection[m_upAxis] * btScalar(0.1f));
     181        start.setOrigin (m_currentPosition + btVector3(btScalar(0.0), btScalar(0.1), btScalar(0.0)));
    183182        end.setOrigin (m_targetPosition);
    184183
     
    345344
    346345        // phase 3: down
    347         btVector3 step_drop = upAxisDirection[m_upAxis] * m_currentStepOffset;
    348         btVector3 gravity_drop = upAxisDirection[m_upAxis] * m_stepHeight;
     346        btVector3 step_drop = btVector3(btScalar(0.0), m_currentStepOffset, btScalar(0.0));
     347        btVector3 gravity_drop = btVector3(btScalar(0.0), m_stepHeight, btScalar(0.0));
    349348        m_targetPosition -= (step_drop + gravity_drop);
    350349
     
    391390
    392391
    393 void btKinematicCharacterController::preStep (  btCollisionWorld* collisionWorld)
     392void btKinematicCharacterController::preStep ( btCollisionWorld* collisionWorld)
    394393{
    395394       
     
    414413}
    415414
    416 void btKinematicCharacterController::playerStep (  btCollisionWorld* collisionWorld, btScalar dt)
     415void btKinematicCharacterController::playerStep ( btCollisionWorld* collisionWorld, btScalar dt)
    417416{
    418417        btTransform xform;
     
    470469        return true;
    471470}
    472 
    473 
    474 void    btKinematicCharacterController::debugDraw(btIDebugDraw* debugDrawer)
    475 {
    476 }
  • code/branches/questsystem5/src/bullet/BulletDynamics/Character/btKinematicCharacterController.h

    r2907 r2908  
    6363
    6464        bool    m_useGhostObjectSweepTest;
    65 
    66         int m_upAxis;
    6765       
    6866        btVector3 computeReflectionDirection (const btVector3& direction, const btVector3& normal);
     
    7068        btVector3 perpindicularComponent (const btVector3& direction, const btVector3& normal);
    7169
    72         bool recoverFromPenetration ( btCollisionWorld* collisionWorld);
     70        bool recoverFromPenetration (btCollisionWorld* collisionWorld);
    7371        void stepUp (btCollisionWorld* collisionWorld);
    7472        void updateTargetPositionBasedOnCollision (const btVector3& hit_normal, btScalar tangentMag = btScalar(0.0), btScalar normalMag = btScalar(1.0));
     
    7674        void stepDown (btCollisionWorld* collisionWorld, btScalar dt);
    7775public:
    78         btKinematicCharacterController (btPairCachingGhostObject* ghostObject,btConvexShape* convexShape,btScalar stepHeight, int upAxis = 1);
     76        btKinematicCharacterController (btPairCachingGhostObject* ghostObject,btConvexShape* convexShape,btScalar stepHeight);
    7977        ~btKinematicCharacterController ();
    8078       
    81 
    82         ///btActionInterface interface
    83         virtual void updateAction( btCollisionWorld* collisionWorld,btScalar deltaTime)
    84         {
    85                 preStep ( collisionWorld);
    86                 playerStep (collisionWorld, deltaTime);
    87         }
    88        
    89         ///btActionInterface interface
    90         void    debugDraw(btIDebugDraw* debugDrawer);
    91 
    92         void setUpAxis (int axis)
    93         {
    94                 if (axis < 0)
    95                         axis = 0;
    96                 if (axis > 2)
    97                         axis = 2;
    98                 m_upAxis = axis;
    99         }
    100 
    10179        virtual void    setWalkDirection(const btVector3& walkDirection)
    10280        {
     
    10785        void warp (const btVector3& origin);
    10886
    109         void preStep (  btCollisionWorld* collisionWorld);
    110         void playerStep ( btCollisionWorld* collisionWorld, btScalar dt);
     87        void preStep ( btCollisionWorld* collisionWorld);
     88        void playerStep (btCollisionWorld* collisionWorld, btScalar dt);
    11189
    11290        void setFallSpeed (btScalar fallSpeed);
Note: See TracChangeset for help on using the changeset viewer.