zoukankan      html  css  js  c++  java
  • FEMFX 仿真之 刚体类 FmRigidBody

    在 FEMFX 中,刚体对象为 FmRigidBody,详见 FEMFX/amd_femfx/src/Simulation/FEMFXRigidBody.h


    FmRigidBody 类的定义为:

    struct FmRigidBody
    {
        uint                  objectId;
        uint                  rbIslandId;         // Island id assigned by rigid body engine; The FEM library will group FEM objects in the same island if connected to the same rigid body island.
        uint                  femIslandId;        // Id of island that contains this body in FEM scene.
        FmRigidBodyState      state;              // Dynamic state of rigid body
        float                 mass;               // Mass of rigid body
        float                 frictionCoeff;      // Used for contacts with this body
        FmMatrix3             bodyInertiaTensor;  // Inertial tensor in rigid body's local space
        FmMatrix3             worldInertiaTensor; // Current inertial tensor in world space
        FmVector3             gravityVector;      // Gravity acceleration, 0 by default; added with FmSceneControlParams::gravityVector
    
        float                 dims[3];            // Shape dimensions (box half-widths)
        float                 maxRadius;          // Largest distance from center to point on rigid body, used to bound motion for CCD
        FmTetMeshBuffer*      collisionObj;       // Used for intersection with FEM tet meshes
        FmAabb                aabb;               // AABB for rigid body
        uint8_t               collisionGroup;     // Collision group index < 32
    
        // These are updated after each pass of solving or stabilization.
        // In a solver pass, deltaVel is change in velocity and deltaAngVel is change in angular velocity.
        // In a stabilization pass, deltaPos is change in position, deltaAngPos is change in "angular position", which can be seen treated as integrated angular velocity.
        // When a user solves external constraints, these should be updated prior to running the next pass.
        FmVector3             deltaVel;
        FmVector3             deltaAngVel;
        FmVector3             deltaPos;
        FmVector3             deltaAngPos;
    
        bool                  foundInConstraint;  // Used to decide whether to add rigid body to constraint island
    
        float                 sleepMaxSpeedThreshold;              // Max speed must be under this threshold for sleeping 
        float                 sleepAvgSpeedThreshold;              // Average speed must be under this threshold for sleeping
        uint                  sleepStableCount;                    // Number of steps that speeds must fall under thresholds to initiate sleeping
    
        FmVelStats            velStats;  // Statistics for sleeping test
    
        void*                 userData;  // User data pointer
        uint16_t              flags;     // Bitwise or of FM_OBJECT_FLAG* values
    }
    

    对各部分成员函数的解释:

    objectId 是该刚体全局独一无二的 id。相关的地方有 FmScene::awakeRigidBodyIds sleepingRigidBodyIds rigidBodyIdxFromId

    rbIslandId femIslandId 关于 island 这个概念,应该是在碰撞检测中常用的,记得在 Bullet Real-Time Physics Simulation 中接触过这个概念。

  • 相关阅读:
    js判断手机访问网站自动跳转到手机版
    php 操作数组 (合并,拆分,追加,查找,删除等)
    jQuery传值方法汇总:jQuery.get、jQuery.getJSON、jQuery.post
    JS 页面跳转
    优秀的项目管理者书籍
    Python 的人生
    架构设计流程梳理
    重新定义自己思考问题的方式
    梳理
    程序员高效工具列表
  • 原文地址:https://www.cnblogs.com/wghou09/p/12704914.html
Copyright © 2011-2022 走看看