Show
Ignore:
Timestamp:
01/28/10 14:26:31 (6 months ago)
Author:
Azaezel
Message:

further documentation on motionstates. removes ApplyForceAndTorqueCallback?. highly newton specific

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • plugins/branches/0185_GEN_PHYSICS_REFACTOR_2/ZBullet/src/PhysicsActor.cpp

    r3318 r3323  
    460460 
    461461//-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ 
    462 void 
    463 PhysicsActor::ApplyForceAndTorqueCallback(const btRigidBody* _body) 
    464 { 
    465     class ApplyForcesEventData 
    466     :   public I_ApplyForcesEventData 
    467     { 
    468         /// @name I_ApplyForcesEventData implementation 
    469         /// @{ 
    470     public: 
    471         /// Get the physics shape associated with this event 
    472         virtual I_PhysicsActor& getActor() 
    473         { 
    474             return *m_pShape; 
    475         } 
    476  
    477         /// Apply a force to this shape 
    478         virtual void applyForce(const Math::Vector3& _force) 
    479         { 
    480             m_pShape->applyForce(_force); 
    481         } 
    482  
    483         /// Apply torque to this shape 
    484         virtual void applyTorque(const Math::Vector3& _torque) 
    485         { 
    486             m_pShape->applyTorque(_torque); 
    487         } 
    488  
    489         /// @} 
    490  
    491         /// @name 'Structors 
    492         /// @{ 
    493     public: 
    494         ApplyForcesEventData(PhysicsActor* _pShape) 
    495         :   m_pShape(_pShape) 
    496         { 
    497         } 
    498  
    499         virtual ~ApplyForcesEventData() 
    500         { 
    501         } 
    502         /// @} 
    503  
    504         /// @name Member Variables 
    505         /// @{ 
    506     private: 
    507         PhysicsActor*   m_pShape; 
    508         /// @} 
    509  
    510     };  // class ApplyForcesEventData; 
    511  
    512     void* pBody = btRigidBodyGetUserData(_body); 
    513     if (pBody != NULL) 
    514     { 
    515         PhysicsActor* pPhysicsActor = static_cast<PhysicsActor*>(pBody); 
    516  
    517         // Only apply forces if the state is active 
    518         if (pPhysicsActor->m_activationState != 0) 
    519         { 
    520             ApplyForcesEventData eventData(pPhysicsActor); 
    521             eventData.getActor().onApplyForcesEvent(eventData); 
    522         } 
    523     } 
    524 } 
    525  
    526 //-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ 
    527 void 
    528 PhysicsActor::ActivationStateCallback(const btRigidBody* _body, unsigned _state) 
    529 { 
    530     void* pBody = btRigidBodyGetUserData(_body); 
    531     if (pBody != NULL) 
    532     { 
    533         static_cast<PhysicsActor*>(pBody)->setActivationState(_state); 
    534     } 
    535 } 
    536  
    537 //-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ 
    538462Engine::Physics::I_PhysicsActor& 
    539463PhysicsActor::TransformEventData::getActor() 
     
    561485    return m_otherActor; 
    562486} 
    563  
     487//-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ 
     488void  
     489PhysicsActor::ZenMotionState::setWorldTransform(const btTransform &_worldTrans) 
     490{ 
     491 
     492} 
    564493//-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ 
    565494Scripting::I_ObjectReference*