本文整理汇总了C++中AABB::SetTransformedAABB方法的典型用法代码示例。如果您正苦于以下问题:C++ AABB::SetTransformedAABB方法的具体用法?C++ AABB::SetTransformedAABB怎么用?C++ AABB::SetTransformedAABB使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AABB
的用法示例。
在下文中一共展示了AABB::SetTransformedAABB方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CalculateTargetAdjustPoint
// Calculates the desired position for the physics box, so that its center will be superimposed with AABB center of provided entity.
// Also adjusts upwards to avoid any obvious floor clipping. Returns desired Position for entity.
Vec3 CIntersectionAssistanceUnit::CalculateTargetAdjustPoint(const IEntity* pEntity, const Matrix34 &wMat, const Vec3& vStartingPos) const
{
// (if present + desired) adjust physbox center to that of owner Ent - to make sure centers of PhysBox + focal ent superimposed
// at the desired position
const IEntity* pFocalEnt = gEnv->pEntitySystem->GetEntity(m_focalEntityId);
if(pFocalEnt)
{
OBB focalOBB;
AABB focalAABB;
// Compensate for actor/non actor entities that require different paths :(
if(CPlayer* pPlayer = static_cast<CPlayer*>(g_pGame->GetIGameFramework()->GetIActorSystem()->GetActor(m_focalEntityId)))
{
EStance playerStance = pPlayer->GetStance();
focalAABB = pPlayer->GetStanceInfo(playerStance)->GetStanceBounds();
}
else
{
pFocalEnt->GetLocalBounds(focalAABB);
}
focalOBB.SetOBBfromAABB(Quat(IDENTITY), focalAABB);
// shift to match focus ent Center (taking into account crouch etc if player).
float fVerticalAdjust = focalOBB.h.z;
// Additionally.. if the new test pos *would* immediately penetrate the floor (assumption based on any part of the volume being < player AABB z min value)
// shift it up.
float fFloorPenetrationAdjust = 0.0f;
AABB wEntABB;
pEntity->GetLocalBounds(wEntABB);
wEntABB.SetTransformedAABB(wMat,wEntABB);
float fFloorClearance = focalOBB.h.z - (wEntABB.GetSize().z * 0.5f);
fFloorPenetrationAdjust += (0.0f - min(fFloorClearance, 0.0f));
// Apply floor clearance + Vertical adjust
Vec3 desiredPos = wMat.GetTranslation() + Vec3(0.0f,0.0f,(fFloorPenetrationAdjust) * kFloorAdjustConstant);
desiredPos += (fVerticalAdjust * pFocalEnt->GetWorldTM().GetColumn2() * kFloorAdjustConstant);
return desiredPos;
}
return wMat.GetTranslation();
}
示例2: SerializeXML
void CAreaProxy::SerializeXML( XmlNodeRef &entityNode,bool bLoading )
{
if (m_nFlags & FLAG_NOT_SERIALIZE)
return;
if (bLoading)
{
XmlNodeRef areaNode = entityNode->findChild( "Area" );
if (!areaNode)
return;
int nId=0,nGroup=0,nPriority=0;
float fProximity = 0;
float fHeight = 0;
areaNode->getAttr( "Id",nId );
areaNode->getAttr( "Group",nGroup );
areaNode->getAttr( "Proximity",fProximity );
areaNode->getAttr( "Priority",nPriority );
m_pArea->SetID(nId);
m_pArea->SetGroup(nGroup);
m_pArea->SetProximity(fProximity);
m_pArea->SetPriority(nPriority);
const char* token(0);
XmlNodeRef pointsNode = areaNode->findChild( "Points" );
if (pointsNode)
{
for (int i = 0; i < pointsNode->getChildCount(); i++)
{
XmlNodeRef pntNode = pointsNode->getChild(i);
Vec3 pos;
if (pntNode->getAttr( "Pos",pos ))
m_localPoints.push_back(pos);
// Get sound obstruction
bool bObstructSound = 0;
pntNode->getAttr("ObstructSound", bObstructSound);
m_abObstructSound.push_back(bObstructSound);
}
m_pArea->SetAreaType( ENTITY_AREA_TYPE_SHAPE );
areaNode->getAttr( "Height",fHeight );
m_pArea->SetHeight(fHeight);
// Set points.
OnMove();
}
else if (areaNode->getAttr("SphereRadius",m_fRadius))
{
// Sphere.
areaNode->getAttr("SphereCenter",m_vCenter);
m_pArea->SetSphere( m_pEntity->GetWorldTM().TransformPoint(m_vCenter),m_fRadius );
}
else if (areaNode->getAttr("VolumeRadius",m_fRadius))
{
areaNode->getAttr("Gravity",m_fGravity);
areaNode->getAttr("DontDisableInvisible", m_bDontDisableInvisible);
AABB box;
box.Reset();
// Bezier Volume.
pointsNode = areaNode->findChild( "BezierPoints" );
if (pointsNode)
{
for (int i = 0; i < pointsNode->getChildCount(); i++)
{
XmlNodeRef pntNode = pointsNode->getChild(i);
Vec3 pt;
if (pntNode->getAttr( "Pos",pt))
{
m_bezierPoints.push_back(pt);
box.Add( pt );
}
}
}
m_pArea->SetAreaType( ENTITY_AREA_TYPE_GRAVITYVOLUME );
if (!m_pEntity->GetRenderProxy())
{
IEntityRenderProxyPtr pRenderProxy = crycomponent_cast<IEntityRenderProxyPtr>(m_pEntity->CreateProxy( ENTITY_PROXY_RENDER ));
m_pEntity->SetFlags(m_pEntity->GetFlags() | ENTITY_FLAG_SEND_RENDER_EVENT);
if (box.min.x > box.max.x)
box.min = box.max = Vec3(0,0,0);
box.min-=Vec3(m_fRadius, m_fRadius, m_fRadius);
box.max+=Vec3(m_fRadius, m_fRadius, m_fRadius);
Matrix34 tm = m_pEntity->GetWorldTM_Fast();
box.SetTransformedAABB( m_pEntity->GetWorldTM_Fast().GetInverted(),box );
pRenderProxy->SetLocalBounds(box, true);
}
OnEnable(m_bIsEnable);
}
else if (areaNode->getAttr("AreaSolidFileName",&token))
{
CCryFile file;
//.........这里部分代码省略.........