本文整理汇总了C++中PhysicsObject::flagset方法的典型用法代码示例。如果您正苦于以下问题:C++ PhysicsObject::flagset方法的具体用法?C++ PhysicsObject::flagset怎么用?C++ PhysicsObject::flagset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhysicsObject
的用法示例。
在下文中一共展示了PhysicsObject::flagset方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: limitmoves
void Footholdtree::limitmoves(PhysicsObject& phobj) const
{
if (phobj.hmobile())
{
double crntx = phobj.crntx();
double nextx = phobj.nextx();
bool left = phobj.hspeed < 0.0f;
double wall = getwall(phobj.fhid, left, phobj.nexty());
bool collision = left ?
crntx >= wall && nextx <= wall :
crntx <= wall && nextx >= wall;
if (!collision && phobj.flagset(PhysicsObject::TURNATEDGES))
{
wall = getedge(phobj.fhid, left);
collision = left ?
crntx >= wall && nextx <= wall :
crntx <= wall && nextx >= wall;
}
if (collision)
{
phobj.limitx(wall);
phobj.clearflag(PhysicsObject::TURNATEDGES);
}
}
if (phobj.vmobile())
{
double crnty = phobj.crnty();
double nexty = phobj.nexty();
auto ground = Range<double>(
getfh(phobj.fhid).resolvex(phobj.crntx()),
getfh(phobj.fhid).resolvex(phobj.nextx())
);
bool collision = crnty <= ground.first() && nexty >= ground.second();
if (collision)
{
phobj.limity(ground.second());
limitmoves(phobj);
}
else
{
if (nexty < borders.first())
{
phobj.limity(borders.first());
}
else if (nexty > borders.second())
{
phobj.limity(borders.second());
}
}
}
}