示例#1
0
    CActionLedgeGrab(CPlayer &player, const QuatT &ledgeLoc, SLedgeTransitionData::EOnLedgeTransition transition, bool endCrouched, bool comingFromOnGround, bool comingFromSprint)
        : TPlayerAction(PP_PlayerActionUrgent, PlayerMannequin.fragmentIDs.ledgeGrab),
          m_player(player),
          m_targetViewDirTime(0.2f),
          m_transitionType(transition),
          m_endCrouched(endCrouched),
          m_comingFromOnGround(comingFromOnGround),
          m_comingFromSprint(comingFromSprint),
          m_haveUnHolsteredWeapon(false)
    {
        SetParam("TargetPos", ledgeLoc);

        Ang3 viewAng;
        viewAng.SetAnglesXYZ( ledgeLoc.q );
        viewAng.y = 0.0f;
        m_targetViewDir = Quat::CreateRotationXYZ( viewAng );
    }
Ang3 CVehicleSeatActionOrientateBoneToView::GetDesiredViewAngles(const Vec3& lookPos, const Vec3& aimPos) const
{
	Vec3 forwardDir = (aimPos - lookPos).GetNormalized();
	Vec3 upDir = Vec3(0.f, 0.f, 1.f);
	Vec3 sideDir = forwardDir.Cross(upDir);
	sideDir.Normalize();
	upDir = sideDir.Cross(forwardDir);
	upDir.Normalize();

	Matrix34 matrix;
	matrix.SetFromVectors(sideDir, forwardDir, upDir, Vec3(0.f, 0.f, 0.f));

	Ang3 lookAngles;
	lookAngles.SetAnglesXYZ(matrix);

	return lookAngles;
}