MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / GetFormationAbsolute

Method GetFormationAbsolute

engine/Poseidon/AI/AIUnit.cpp:1592–1616  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1590 case AI::PosFlankRight:
1591 offset[0] += sizeX * coef;
1592 break;
1593 }
1594 return _formationPos + offset;
1595}
1596
1597Vector3 AIUnit::GetFormationAbsolute(AIUnit* leader) const
1598{
1599 // absolute formation position
1600 // suppose leader is formation leader
1601 EntityAI* lVehicle = leader->GetVehicle();
1602
1603 AISubgroup* subgrp = leader->GetSubgroup();
1604 Matrix4 transform;
1605 Vector3Val formDir = subgrp->GetFormationDirection();
1606 transform.SetDirectionAndUp(formDir, VUp);
1607 transform.SetPosition(lVehicle->Position());
1608
1609 Vector3 pos = transform.FastTransform(GetFormationRelative() - leader->GetFormationRelative());
1610 if (GetVehicle()->GetType()->GetKind() != VAir)
1611 {
1612 // absolute formation position
1613 pos[1] = GLandscape->SurfaceYAboveWater(pos[0], pos[2]);
1614 }
1615 else
1616 {
1617 float landY = GLandscape->SurfaceYAboveWater(pos[0], pos[2]);
1618 saturateMax(pos[1], landY + 25);
1619 }

Callers 8

FindHideBehindMethod · 0.80
HideThinkMethod · 0.80
DrawDiagsMethod · 0.80
BeginArcadeMethod · 0.80
IsAwayMethod · 0.80
FormationPilotMethod · 0.80
UpdateFormationCoefMethod · 0.80
DrawHUDMethod · 0.80

Calls 13

saturateMaxFunction · 0.85
GetFormationDirectionMethod · 0.80
GetFormationRelativeMethod · 0.80
SurfaceYAboveWaterMethod · 0.80
GetVehicleMethod · 0.45
GetSubgroupMethod · 0.45
SetDirectionAndUpMethod · 0.45
SetPositionMethod · 0.45
PositionMethod · 0.45
FastTransformMethod · 0.45
GetKindMethod · 0.45
GetTypeMethod · 0.45

Tested by

no test coverage detected