本文整理汇总了C++中smartbody::SBScene::getSteerManager方法的典型用法代码示例。如果您正苦于以下问题:C++ SBScene::getSteerManager方法的具体用法?C++ SBScene::getSteerManager怎么用?C++ SBScene::getSteerManager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类smartbody::SBScene
的用法示例。
在下文中一共展示了SBScene::getSteerManager方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initSteeringSpaceObject
void SbmPawn::initSteeringSpaceObject()
{
SmartBody::SBScene* scene = SmartBody::SBScene::getScene();
if (!scene->getSteerManager()->getEngineDriver()->isInitialized()) return;
if (!scene->getSteerManager()->getEngineDriver()->_engine) return;
float steerScale = 1.0f / scene->getScale();
// get the size of the steering object
float x, y, z, h, p, r;
this->get_world_offset(x, y, z, h, p, r);
gwiz::quat_t q = gwiz::euler_t(p,h,r);
SrQuat pawnQ = SrQuat((float)q.w(), (float)q.x(), (float)q.y(), (float)q.z());
SrVec size = this->getVec3Attribute("collisionShapeScale");
size = size*pawnQ;
steeringSpaceObjSize.x = fabs(size.x);
steeringSpaceObjSize.y = fabs(size.y);
steeringSpaceObjSize.z = fabs(size.z);
float xmin = (x - steeringSpaceObjSize.x) / steerScale;
float xmax = (x + steeringSpaceObjSize.x) / steerScale;
float ymin = (y - steeringSpaceObjSize.y) / steerScale;
float ymax = (y + steeringSpaceObjSize.y) / steerScale;
float zmin = (z - steeringSpaceObjSize.z) / steerScale;
float zmax = (z + steeringSpaceObjSize.z) / steerScale;
//LOG("steeringSpaceObjSize = %f %f %f, scale = %f", steeringSpaceObjSize.x, steeringSpaceObjSize.y, steeringSpaceObjSize.z, steerScale);
if (steeringSpaceObj_p)
{
const Util::AxisAlignedBox& box = steeringSpaceObj_p->getBounds();
if (fabs(box.xmax - xmax) > .0001 ||
fabs(box.xmin - xmin) > .0001 ||
fabs(box.ymax - ymax) > .0001 ||
fabs(box.ymin - ymin) > .0001 ||
fabs(box.zmax - zmax) > .0001 ||
fabs(box.zmin - zmin) > .0001)
{
SmartBody::SBScene::getScene()->getSteerManager()->getEngineDriver()->_engine->getSpatialDatabase()->removeObject(steeringSpaceObj_p, steeringSpaceObj_p->getBounds());
Util::AxisAlignedBox& mutableBox = const_cast<Util::AxisAlignedBox&>(box);
mutableBox.xmax = xmax;
mutableBox.xmin = xmin;
mutableBox.ymax = ymax;
mutableBox.ymin = ymin;
mutableBox.zmax = zmax;
mutableBox.zmin = zmin;
SmartBody::SBScene::getScene()->getSteerManager()->getEngineDriver()->_engine->getSpatialDatabase()->addObject(steeringSpaceObj_p, steeringSpaceObj_p->getBounds());
}
}
else
{
steeringSpaceObj_p = new SteerLib::BoxObstacle(xmin, xmax, ymin, ymax, zmin, zmax);
SmartBody::SBScene::getScene()->getSteerManager()->getEngineDriver()->_engine->addObstacle(steeringSpaceObj_p);
SmartBody::SBScene::getScene()->getSteerManager()->getEngineDriver()->_engine->getSpatialDatabase()->addObject(steeringSpaceObj_p, steeringSpaceObj_p->getBounds());
}
}