本文整理汇总了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