本文整理汇总了C++中CMovementRequest::GetContext方法的典型用法代码示例。如果您正苦于以下问题:C++ CMovementRequest::GetContext方法的具体用法?C++ CMovementRequest::GetContext怎么用?C++ CMovementRequest::GetContext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMovementRequest
的用法示例。
在下文中一共展示了CMovementRequest::GetContext方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
STransitionSelectionParams::STransitionSelectionParams(
const CMovementTransitions& transitions,
const CPlayer& player,
const CMovementRequest& request,
const Vec3& playerPos,
const SMovementTransitionsSample& oldSample,
const SMovementTransitionsSample& newSample,
const bool bHasLockedBodyTarget,
const Vec3& targetBodyDirection,
const Lineseg& safeLine,
const CTimeValue runningDuration,
const uint8 _allowedTransitionFlags,
const float entitySpeed2D,
const float entitySpeed2DAvg,
const SExactPositioningTarget*const pExactPositioningTarget,
const EStance stance,
SActorFrameMovementParams*const pMoveParams) : m_transitionType(eTT_None), m_transitionDistance(0.0f), m_pseudoSpeed(0.0f), m_travelAngle(0.0f), m_jukeAngle(0.0f), m_stance(stance)
{
// TODO: check for flatness?
m_travelAngle = Ang3::CreateRadZ( newSample.bodyDirection, oldSample.moveDirection ); // probably should be oldSample?
m_context = request.HasContext() ? request.GetContext() : 0;
// --------------------------------------------------------------------------
// Calculate vToMoveTarget, vAfterMoveTarget, distToMoveTarget, distAfterMoveTarget & allowedTransitionFlags
Vec3 vToMoveTarget, vAfterMoveTarget;
float distToMoveTarget, distAfterMoveTarget;
uint8 allowedTransitionFlags = _allowedTransitionFlags;
{
if (request.HasMoveTarget())
{
const Vec3& vMoveTarget = request.GetMoveTarget();
vToMoveTarget = vMoveTarget - playerPos;
distToMoveTarget = vToMoveTarget.GetLength2D();
m_future.hasMoveTarget = true;
m_future.vMoveTarget = vMoveTarget;
// Disallow certain transitions when preparing an exact positioning target
// and fudge the distance to make sure we don't start when too close to it
if (pExactPositioningTarget && pExactPositioningTarget->preparing && !pExactPositioningTarget->activated)
{
allowedTransitionFlags &= ~BIT(eTT_Stop);
allowedTransitionFlags &= ~BIT(eTT_DirectionChange);
const Vec3& exactPosLocation = pExactPositioningTarget->location.t;
const float distFromMoveTargetToExactPosSquared = vMoveTarget.GetSquaredDistance(exactPosLocation);
const float minimumDangerDistance = 0.1f;
const float maxDistanceTraveledPerFrame = gEnv->pTimer->GetFrameTime() * 12.5f;
const float dangerDistance = max(minimumDangerDistance, maxDistanceTraveledPerFrame);
const bool moveTargetIsWithinDangerDistance = (distFromMoveTargetToExactPosSquared <= sqr(dangerDistance));
if (moveTargetIsWithinDangerDistance)
{
// Fudge distToMoveTarget so we start at least distanceTraveledInTwoFrames
// This only works for eTT_Start transitions (but we disabled the others above)
distToMoveTarget = max(0.0f, distToMoveTarget - dangerDistance);
}
}
if (request.HasInflectionPoint())
{
const Vec3& vInflectionPoint = request.GetInflectionPoint();
vAfterMoveTarget = vInflectionPoint - vMoveTarget;
distAfterMoveTarget = vAfterMoveTarget.GetLength2D();
}
else
{
vAfterMoveTarget.zero();
distAfterMoveTarget = 0.0f;
}
}
else
{
m_future.hasMoveTarget = false;
vToMoveTarget.zero();
vAfterMoveTarget.zero();
distToMoveTarget = distAfterMoveTarget = 0.0f;
}
}
// --------------------------------------------------------------------------
const float maximumSpeedForStart = 0.5f;
const float minimumSpeedForWalkStop = 1.0f;
const float minimumSpeedForRunStop = 3.5f;
const float minimumRunningDurationForRunStop = 1.0f; // (seconds)
const float minimumSpeedForJuke = 4.4f*0.6f; // 4.4 is slowest runspeed in Crysis2; 0.6 is the strafing slowdown
const float minimumRunningDurationForJuke = 0.1f; // (seconds)
if (newSample.pseudoSpeed > 0.0f)
{
// Either:
// - we are in a Stop and want to start again <-- note oldPseudoSpeed cannot be used to detect this, it could be already 0 from prev. frame
//.........这里部分代码省略.........