Group Target Configurations
A Group Target is an entity whose world transform is the weighted centroid of a runtime-editable subject list. You point a camera at it like any other target, and the cam frames “where the group is” rather than chasing any single subject.
For the concept, centroid modes, subject-management API, and pitfalls, see The Basics: Group Targets. For the full per-field reference and the registry bus, see Group Targets (Framework API).
Contents
Recipe: Two-Player Party Cam
A single cam that frames both players, sliding smoothly as they spread apart and converge.
Steps
Create a Group Target entity in your level (a plain entity with
TransformComponentis fine).Add
GroupTargetComponentto it. Configure:- Name →
"Party"(or any string — this is your registry key). - Centroid Mode →
WeightedMean. - Smoothing Halflife →
0.2(gentle smoothing so the centroid doesn’t jitter when players move).
- Name →
Add Subjects at level start (or whenever players spawn):
GS_PhantomCam::GroupTargetRequestBus::Event( groupEntityId, &GS_PhantomCam::GroupTargetRequests::AddSubject, player1EntityId, 1.0f); // equal weight GS_PhantomCam::GroupTargetRequestBus::Event( groupEntityId, &GS_PhantomCam::GroupTargetRequests::AddSubject, player2EntityId, 1.0f);On the Phantom Camera: Set the Body and Aim stages’ Target Mode to
GroupTargetand Group Target Name to"Party". The stages will resolve the group entity through the Cam Manager registry at runtime.
The cam now points at the weighted midpoint of both players. As they move, the centroid follows.
Tip — pull the cam back as the spread grows. Pair this group cam with a
DynamicOrbitBodyand adjust the orbit shape’s radius at runtime based on subject spread. The group’s centroid is the pivot; the cam stays a healthy distance back so both subjects stay in frame. See the Group-Framing Cam recipe for the stage composition side.
Recipe: Combat Encounter Frame
The cam frames an evolving encounter. Subjects are added when combatants engage and removed when they disengage or die.
Steps
Create a Group Target named
"CurrentCombat"(or similar).On combat start, add the player and the engaged enemies:
AddSubject(player, weight: 2.0); // weight player higher for (each enemy in encounter): AddSubject(enemy, weight: 1.0);On enemy death or disengage, remove the subject:
RemoveSubject(deadEnemy);On combat end, clear:
ClearSubjects();Set the cam’s Body and Aim to
GroupTargetmode with name"CurrentCombat".
Why weight the player higher? Pure equal-weighting means a single enemy at long range drags the cam half-way to them. Weighting the player higher keeps framing centered on the player while still acknowledging the enemy’s presence.
When m_deactivateWhenEmpty is true (default), the cam falls back to hold-last-pose if the encounter clears completely — handy for the moment between encounters.
Recipe: Collapse to Single View
For multi-channel projects: when all players converge, switch from split-screen to a single shared cam, then receive a UI signal at the moment of collapse.
Steps
Create a Group Target tracking all players (same as the party cam recipe).
Author a shared cam outside any rig prefab. Set:
- Channel Scope →
TrueUnique. - Show Advanced → on.
- All Channels Share → on.
- Body / Aim Target Mode →
GroupTarget, name →"Party".
- Channel Scope →
Tune priority so the shared cam wins arbitration when players are close enough (e.g. use a
CameraInfluenceFieldvolume around the players’ convergence point).Listen for the collapse signal in your UI controller:
void OnAllChannelsActivatedSharedCam(AZ::EntityId sharedCam) { // All channels selected the same shared cam — switch to single-view layout. }
When players converge such that the shared cam wins in every channel simultaneously, the Cam Manager fires OnAllChannelsActivatedSharedCam once on the edge. UI hides split-screen dividers and shows the single shared view.
See Channel Tier Configurations for the surrounding multi-channel setup.
See Also
Related recipe collections:
- PhantomCam Configurations — the Group-Framing Cam recipe pairs the body / aim composition with one of these group targets.
- Channel Tier Configurations — the multi-channel setup the collapse recipe sits inside.
- Influence Field Configurations — priority shifts for the convergence trigger.
Basics this builds on:
- The Basics: Group Targets — centroid modes, subject-management API, pitfalls.
Framework API:
- Group Targets — full per-field reference, registry bus, evaluation algorithm.
- Phantom Cameras — Target Routing —
CamTargetMode::GroupTarget.