当前位置: 首页>>代码示例>>C++>>正文


C++ PhysicalObject::getBody方法代码示例

本文整理汇总了C++中PhysicalObject::getBody方法的典型用法代码示例。如果您正苦于以下问题:C++ PhysicalObject::getBody方法的具体用法?C++ PhysicalObject::getBody怎么用?C++ PhysicalObject::getBody使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PhysicalObject的用法示例。


在下文中一共展示了PhysicalObject::getBody方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: update

/** Update the world and the track.
 *  \param dt Time step size. 
 */
void ThreeStrikesBattle::update(float dt)
{
    WorldWithRank::update(dt);
    WorldWithRank::updateTrack(dt);
    
    core::vector3df tire_offset;
    std::string tire;
    float scale = 0.5f;
    float radius = 0.5f;
    PhysicalObject::bodyTypes tire_model;

    // insert blown away tire(s) now if was requested
    while (m_insert_tire > 0)
    {        
        if(m_insert_tire == 1)
        {
            tire_offset = core::vector3df(0.0f, 0.0f, 0.0f);
            tire = file_manager->getModelFile("tire.b3d");
            scale = 0.5f;
            radius = 0.5f;
            tire_model = PhysicalObject::MP_CYLINDER_Y;
        }
        else
        {
            scale = 1.0f;
            tire_model = PhysicalObject::MP_CYLINDER_X;
            radius = m_tire_radius[m_insert_tire-2];
            tire_offset = m_tire_offsets[m_insert_tire-2];
            if     (m_insert_tire == 2)
                tire = m_tire_dir+"/wheel-rear-left.b3d";
            else if(m_insert_tire == 3)
                tire = m_tire_dir+"/wheel-front-left.b3d";
            else if(m_insert_tire == 4)
                tire = m_tire_dir+"/wheel-front-right.b3d";
            else if(m_insert_tire == 5)
                tire = m_tire_dir+"/wheel-rear-right.b3d";
        }

        TrackObjectManager* tom = m_track->getTrackObjectManager();        
        PhysicalObject* obj = 
            tom->insertObject(tire,
                              tire_model,
                              15 /* mass */,
                              radius /* radius */,
                              core::vector3df(800.0f,0,m_tire_rotation 
                                                      / M_PI * 180 + 180) ,
                              m_tire_position + tire_offset,
                              core::vector3df(scale,scale,scale) /* scale */);
        
        // FIXME: orient the force relative to kart orientation
        obj->getBody()->applyCentralForce(btVector3(60.0f, 0.0f, 0.0f));

        m_insert_tire--;
        if(m_insert_tire == 1)
            m_insert_tire = 0;
        
        m_tires.push_back(obj);
    }
}   // update
开发者ID:langresser,项目名称:stk,代码行数:62,代码来源:three_strikes_battle.cpp


注:本文中的PhysicalObject::getBody方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。