2

弾丸物理学または同様の物理エンジンを利用して、2 本足の人間のような体のリアルなスケルトン シミュレーションを作成したいと考えています。つまり、2 つの「脚」の上に丸い塊でできた「ボディ」のシミュレーションを作成します。各脚は 3 つのジョイントを介して接続された 3 つのソリッド ピースで構成されており、各ジョイントにはある程度の自由度と限られた可動範囲があります。人間の腰、膝、足首と同様の各方向。

私は現実的なモデルを目指しているので、すべての関節が正しくバランスが取れている場合にのみ「立ち」、そうでない場合は落下します。

既存のチュートリアルやリソースへの指示、提案、またはポインタは大歓迎です! これは、ゼロから行う非常に多くの作業のように見えます...

4

4 に答える 4

6

OpenSim プロジェクト (opensim.stanford.edu) を確認してください。このプロジェクトは、バイオメカニクス コミュニティによって、臨床応用などの人間の動きを研究するために頻繁に使用されています。OpenSim では、人体モデルは関節のトルクだけではなく、筋肉によって作動することがよくあります。

OpenSim は、Simbody マルチボディ ダイナミクス ライブラリの上に構築されています。Simbody の例を参照して、ヒューマノイドのモデルで実行を開始してください: https://github.com/simbody/simbody/blob/master/Simbody/examples/JaredsDude.cpp .

于 2014-03-28T01:12:42.103 に答える
4

現在、同様のコードに取り組んでいます。私のアプローチは、Bullet Physics Rag Doll Demo を出発点として使用することです。体のパーツがジョイントでつながった縫いぐるみ人形です。

次に、Bullet Physics Dynamic Control Demo を使用して関節の曲げ方を学習します。現時点で難しい部分は、すべてのパラメーターを設定することです。

コンストレイントによって接続された 2 つの剛体を作成し、コンストレイント モーターをアクティブにしてジョイントを曲げる方法を学習することをお勧めします。

以下は、Bullet Physics で剛体と拘束がどのように機能するかを学習するために使用しているコードです。このコードは、ヒンジ制約によって接続された 2 つのブロックを作成します。update 関数は、時間の経過とともにゆっくりとヒンジ制約を曲げます。

これができたので、ラグドールに戻って関節を調整します。

class Simple
{
private:
    btScalar targetAngle;

    btCollisionShape* alphaCollisionShape;
    btCollisionShape* bravoCollisionShape;
    btRigidBody* alphaRigidBody;
    btRigidBody* bravoRigidBody;
    btHingeConstraint* hingeConstraint;

    btDynamicsWorld* dynamicsWorld;

public:
    ~Simple( void )
    {
    }

    btRigidBody* createRigidBody( btCollisionShape* collisionShape, 
                  btScalar mass, 
                  const btTransform& transform ) const
    {
    // calculate inertia
    btVector3 localInertia( 0.0f, 0.0f, 0.0f );
    collisionShape->calculateLocalInertia( mass, localInertia );    

    // create motion state
    btDefaultMotionState* defaultMotionState 
        = new btDefaultMotionState( transform );

    // create rigid body
    btRigidBody::btRigidBodyConstructionInfo rigidBodyConstructionInfo( 
        mass, defaultMotionState, collisionShape, localInertia );
    btRigidBody* rigidBody = new btRigidBody( rigidBodyConstructionInfo );      

    return rigidBody;
    }

    void Init( btDynamicsWorld* dynamicsWorld )
    {
    this->targetAngle = 0.0f;

    this->dynamicsWorld = dynamicsWorld;

    // create collision shapes
    const btVector3 alphaBoxHalfExtents( 0.5f, 0.5f, 0.5f );
    alphaCollisionShape = new btBoxShape( alphaBoxHalfExtents );

    //
    const btVector3 bravoBoxHalfExtents( 0.5f, 0.5f, 0.5f );
    bravoCollisionShape = new btBoxShape( bravoBoxHalfExtents );

    // create alpha rigid body
    const btScalar alphaMass = 10.0f;
    btTransform alphaTransform;
    alphaTransform.setIdentity();
    const btVector3 alphaOrigin( 54.0f, 0.5f, 50.0f );  
    alphaTransform.setOrigin( alphaOrigin );
    alphaRigidBody = createRigidBody( alphaCollisionShape, alphaMass, alphaTransform );
    dynamicsWorld->addRigidBody( alphaRigidBody );

    // create bravo rigid body
    const btScalar bravoMass = 1.0f;
    btTransform bravoTransform;
    bravoTransform.setIdentity();
    const btVector3 bravoOrigin( 56.0f, 0.5f, 50.0f );  
    bravoTransform.setOrigin( bravoOrigin );
    bravoRigidBody = createRigidBody( bravoCollisionShape, bravoMass, bravoTransform );
    dynamicsWorld->addRigidBody( bravoRigidBody );

    // create a constraint
    const btVector3 pivotInA( 1.0f, 0.0f, 0.0f );   
    const btVector3 pivotInB( -1.0f, 0.0f, 0.0f );
    btVector3 axisInA( 0.0f, 1.0f, 0.0f );
    btVector3 axisInB( 0.0f, 1.0f, 0.0f );
    bool useReferenceFrameA = false;
    hingeConstraint = new btHingeConstraint( 
        *alphaRigidBody,
        *bravoRigidBody,
        pivotInA,
        pivotInB,
        axisInA,
        axisInB,
        useReferenceFrameA );

    // set constraint limit
    const btScalar low = -M_PI;
    const btScalar high = M_PI;
    hingeConstraint->setLimit( low, high );

    // add constraint to the world
    const bool isDisableCollisionsBetweenLinkedBodies = false;
    dynamicsWorld->addConstraint( hingeConstraint, 
                      isDisableCollisionsBetweenLinkedBodies );
    }

    void Update( float deltaTime )
    {
    alphaRigidBody->activate();
    bravoRigidBody->activate();

    bool isEnableMotor = true;
    btScalar maxMotorImpulse = 1.0f; // 1.0f / 8.0f is about the minimum

    hingeConstraint->enableMotor( isEnableMotor );
    hingeConstraint->setMaxMotorImpulse( maxMotorImpulse );

    targetAngle += 0.1f * deltaTime;
    hingeConstraint->setMotorTarget( targetAngle, deltaTime );  
    }

};
于 2011-07-12T06:28:41.573 に答える
1

長谷 & 山崎 (2002) による「3 次元全身神経筋骨格モデルによる人間の移動のコンピューター シミュレーション研究」を見つけました。

人間の歩行運動を正確にシミュレートするために、神経系と筋骨格系の両方からなる三次元の全身構造を持つモデルが提案されました。人体のダイナミクスは、14 個のリジッド リンク システムと 60 個の筋肉モデルによって表現されました。

于 2011-12-08T11:35:20.360 に答える
0

ゼロから作るのは大変です、間違いなく。あなたの目的が何なのかわかりません。しかし、ホイールを再設計する必要はありません。Unreal Engineをご覧になりましたか? そこで再利用できるものが見つかるかもしれません。多くのゲームは、このエンジンの上に構築されています。

于 2011-05-13T21:47:44.730 に答える