Body Stage Variants

Body stage catalog — DefaultFollowBody, OrbitBody, DynamicOrbitBody, LeadingFollowBody, TrackBody. Each variant’s kinematic model, authored fields, and state-inheritance support.

The Body stage owns state.position for each tick. Five variants ship with GS_PhantomCam — each with its own kinematic model (orbit math, spring damping, path interpolation, band response, etc.). All variants share a target-routing front-end via the CamTargetMode enum documented in Stage Pipeline. Per-variant state inheritance support is summarized below; see State Inheritance for the full protocol.

Body stage slot on the Phantom Camera component

 

Contents


DefaultFollowBody

Simple follow camera. Tracks a target at an authored offset, position-space spring damped.

Kinematic model

destPos        = targetTM.translation + ApplyOffset(offset, targetTM, isRelative)
state.position = SimpleSpringDamperExact(m_idealPosition, m_springVelocity,
                                         destPos, halflife, dt)

Spring runs against an internal m_idealPosition per the decoupled-ideal pattern. On ctx.snapThisFrame, m_idealPosition = destPos directly.

Authored fields

FieldDefaultPurpose
m_targetModeTransformHow to resolve the follow target.
m_overrideEntity(entity slot)Used when m_targetMode == Override.
m_groupTargetName""Used when m_targetMode == GroupTarget.
m_offset(0, 0, 0)Offset applied before damping.
m_offsetIsRelativefalseWorld axes (false) or target-relative basis (true).
m_halflife0.1Spring halflife.

State inheritance

None. Default IBodyStage virtuals return false. Inheritance into a Default Follow falls through to the Blend Profile’s visual bridge.


OrbitBody

Fixed orbital pose around the target — authored yaw, pitch, and radius, no input. The “static orbit cam.” Successor to the retired StaticOrbit_PhantomCamComponent.

Kinematic model

destPos     = targetTM.translation + offset
pitchRad    = clamp(degToRad(m_orbitPitchDeg), -89°, +89°)
yawRad      = degToRad(m_orbitYawDeg)

orbitOffset = m_orbitRadius * (cos(pitch)*cos(yaw), cos(pitch)*sin(yaw), sin(pitch))
destPos    += orbitOffset

state.position = SimpleSpringDamperExact(m_idealPosition, m_springVelocity,
                                         destPos, m_halflife, dt)

The cached pivot m_lastPivot (the post-offset, pre-orbit pivot point) is published through TryGetPoseSnapshot for inheritance into orbit-style adopters.

Authored fields

FieldDefaultPurpose
m_targetModeTransformTarget routing.
m_overrideEntityWhen m_targetMode == Override.
m_groupTargetName""When m_targetMode == GroupTarget.
m_offset(0, 0, 0)Pre-orbit offset.
m_offsetIsRelativefalseBasis.
m_orbitRadius5.0Distance from pivot to cam.
m_orbitYawDeg45.0Horizontal angle around pivot.
m_orbitPitchDeg20.0Vertical angle (clamped −89° to +89°).
m_halflife0.1Spring halflife (0 = snap).

State inheritance

DirectionBehavior
GetPublishes the cleanest snapshot in the framework: worldPos = m_idealPosition, worldFwd toward cached pivot, pivotPos = m_lastPivot, AND direct angular state from authored yaw / pitch (yawRad, pitchRad, angularStateValid = true). Orbit-style adopters receive ANGULAR-mode handoff with no back-derivation.
AdoptNot implemented — left at default false. The authored yaw / pitch define the static shot’s identity; accepting inbound pose would defeat author intent. Blend Profile’s visual bridge handles inbound transitions.

DynamicOrbitBody

Input-driven orbit camera around a target, shaped by a CameraOrbitShape (.camorbit) asset. The current go-to body for orbit-style player cams. Successor to the retired OrbitCam variant.

Unified drive model

The stage holds target angles (m_targetYaw, m_targetPitch) and damps the cam’s position toward whatever those angles imply on the orbit surface via the Orbital Solver Utility. Target angles are written by:

  1. Snap seeding (m_initialYawDeg / m_initialPitchDeg) on first activate or ctx.snapThisFrame.
  2. External scripted calls via DynamicOrbitBodyRequestBus::SetOrbit(yawRad, pitchRad).
  3. Per-tick input integration — when an OrbitInputProvider bus handler is bound to the cam’s entity (the Camera Input Reader component), the body polls input deltas and integrates them. Gated on ctx.hasFocus || ctx.alwaysUpdate || ctx.blendingOut.

No drive-mode enum. Multiple writers compose; last write wins per tick; solver damping shapes the visual response.

Static-orbit behavior is also achievable here by authoring initial angles and not installing an input provider — target angles never change, solver damps once, holds. The separate OrbitBody class is retained for the explicit “static shot” identity case.

Kinematic model

// 1. Resolve pivot (post-offset target).
pivot = targetTM.translation + offset
m_lastResolvedPivot = pivot   // cached for inheritance Get

// 2. Inheritance consume (if pending). Sets m_targetYaw / m_targetPitch /
//    m_idealPosition. See [State Inheritance].

// 3. Snap handling — reset target angles to authored seeds on
//    ctx.snapThisFrame (unless inheritance just consumed).
if (ctx.snapThisFrame && !consumedAdoption):
    m_targetYaw   = degToRad(m_initialYawDeg)
    m_targetPitch = degToRad(m_initialPitchDeg)

// 4. Input integration (if cam has an OrbitInputProvider AND
//    ctx.hasFocus || alwaysUpdate || blendingOut).
yawDelta, pitchDelta = poll OrbitInputProvider
m_targetYaw   += yawDelta   * degToRad(m_yawSpeed)   * dt
m_targetPitch += pitchDelta * degToRad(m_pitchSpeed) * dt
m_targetYaw   = WrapYawToPi(m_targetYaw)
m_targetPitch = clamp(m_targetPitch, kPitchAtLow, kPitchAtHigh)

// 5. Orbit shape evaluation.
shapePoint = m_orbitShape->EvaluateAtPitch(m_targetPitch)  // (radius, height)
desiredPos = pivot + (shapePoint.radius * cos(m_targetYaw),
                     shapePoint.radius * sin(m_targetYaw),
                     shapePoint.height)

// 6. Solver damping via BlendPositionAroundPivot.
alpha = HalflifeAlpha(m_blendHalflife, dt)
m_idealPosition = GS_Core::Math::BlendPositionAroundPivot(
                    m_idealPosition, desiredPos, pivot,
                    alpha, m_blendShape, +Z)

state.position = m_idealPosition

Authored fields

FieldDefaultPurpose
m_targetModeTransformTarget routing.
m_overrideEntityWhen m_targetMode == Override.
m_groupTargetName""When m_targetMode == GroupTarget.
m_offset(0, 0, 0)Pivot offset from target.
m_offsetIsRelativefalseBasis.
m_orbitShape(asset slot).camorbit asset defining the surface. See Orbit Profiles.
m_yawSpeed90Degrees / sec per unit input on yaw.
m_pitchSpeed60Degrees / sec per unit input on pitch.
m_blendHalflife0.10Damping halflife — the solver call IS the smoothing.
m_blendShapeSphericalSolver shape (Spherical allows arbitrary surface; Cylindrical constrains height).
m_initialYawDeg180.0Snap seed yaw. 180° = directly behind target.
m_initialPitchDeg0.0Snap seed pitch. 0° = mid band height.
m_debugPrintfalsePer-tick AZ_Printf of inputs / target angles / shape output / committed position.

Companion bus

DynamicOrbitBodyRequestBus (per-entity, addressed by cam EntityId):

virtual void  SetOrbit(float yawRad, float pitchRad) = 0;
virtual float GetCurrentTargetYaw()   const = 0;
virtual float GetCurrentTargetPitch() const = 0;

SetOrbit uses ShortestYawTarget to keep the damping arc bounded — prevents the solver taking the long way around for distant yaw writes.

State inheritance

Full Get + Adopt. Two derivation paths:

PathTriggerBehavior
ANGULAR (preferred)snap.angularStateValid == true (source published authored angles)Inherit raw yawRad / pitchRad directly via ShortestYawTarget + WrapYawToPi + pitch clamp. Preserves angular continuity across different shape assets.
POSITION (fallback)Source has no angular state, just worldPos + optional pivotPosBack-derive yaw from (worldPos − pivot) via atan2; search the shape for the matching pitch via FindPitchOnShape.

Both seed m_idealPosition = snap.worldPos and set consumedAdoption = true so subsequent snap-clobber logic is gated.

Get publishes m_idealPosition, world-forward toward cached pivot, pivotPos = m_lastResolvedPivot, pivotEntity = m_lastResolvedPivotEntity, and direct authored m_targetYaw / m_targetPitch + angularStateValid = true.

Init contract

Init() overrides to force-load m_orbitShape via AssetManager::GetAsset + BlockUntilLoadComplete per the asset-fresh-load pattern. Without this, in-editor .camorbit edits don’t propagate to the runtime body until restart.


LeadingFollowBody

Held-position cam that slides along an arc around the target only when the target leaves an authored distance band. Leading-look / “Gears of War”-style follow — heading-agnostic, so abrupt 180° turns by the target don’t swing the cam.

Kinematic model

distXY = horizontal distance between cam and target (at offset's height)

if inner < distXY < outer:
    hold position   // cam stays put within the band
else if distXY > outer:
    slide toward target along an arc until just inside outer
else if distXY < inner:
    slide away from target along an arc until just outside inner

// Slides use the orbital solver around the target as pivot — cam arcs
// around the target during band response rather than cutting through.

// Z tracking: independent linear-halflife lowpass on the Z axis, mirroring
// target Z without affecting XY band math.

// Optional center-on-heading: after a configurable stillness delay, cam arcs
// around target to settle behind (or off-axis behind via m_idleYawOffsetDeg)
// at the current radius.

Authored fields

FieldDefaultPurpose
m_targetModeTransformTarget routing.
m_overrideEntity / m_groupTargetNameMode-dependent.
m_offset(0, 0, 1.6)Offset applied before band math. Cam rides at this Z height.
m_offsetIsRelativefalseBasis.
m_innerRadius2.0Min cam-target XY distance.
m_outerRadius5.0Max cam-target XY distance.
m_hardClampEnabledfalseOptional absolute outer cap.
m_hardClampDistance8.0Hard cap (when enabled).
m_radialHalflife0.25Arc-slide halflife when outside the envelope.
m_heightHalflife0.50Independent Z follow halflife.
m_blendShapeCylindricalSolver shape for band response — cam stays in working height plane. Downgradable to Linear for short displacements.
m_centerOnHeadingfalseEnable idle reposition.
m_idleVelocityThreshold0.10 m/sXY speed below which the idle timer accumulates.
m_idleDelay1.50 sStillness duration before reposition engages.
m_reorientHalflife0.60Idle reposition arc halflife.
m_idleYawOffsetDeg0Offset from “directly behind” during reposition. ± shifts off-axis.

State inheritance

DirectionBehavior
GetReturns m_idealPosition, world-forward toward cached target, pivotPos = m_lastTargetPoint. No angular state.
AdoptPure stash. Evaluate consume block takes source snap.worldFwd, flattens to XY, places m_idealPosition = targetPoint − inboundFwd * seedDist at band-natural distance (lerp(inner, outer, 0.6)). Cam inherits source’s facing at this body’s preferred standoff. Z naturally lands at targetPoint.Z (inboundFwd is XY-flattened) — a from-below source produces a band-natural pose, not stuck-below framing.

Authoring gotcha. If the matched Blend Profile entry has m_inheritState unchecked, the snap-on-activation block fires instead of the consume block. Symptom: “cam orients behind the player’s travel direction regardless of source facing.” The fix is data-side — check the inherit flag in the asset.


TrackBody

Spline-bound dolly camera. Slides along a SplineComponent, interpolating two authored TrackBodyData blocks (start + end) by spline position (globalT 0..1). Successor to the retired Track_PhantomCamComponent.

Per-endpoint data blocks carry offset, halflife, and an optional FoV override.

Kinematic model

// Resolve nearest spline point to current target.
splineHit = spline->FindClosestWorldPoint(targetTM.translation)
globalT   = splineHit.normalizedDistance   // 0..1 along spline

// Lerp data blocks.
offset    = lerp(m_startData.offset,   m_endData.offset,   globalT)
halflife  = lerp(m_startData.halflife, m_endData.halflife, globalT)
fovDest   = (m_endData.fieldOfView > 0)
            ? lerp(m_startData.fieldOfView, m_endData.fieldOfView, globalT)
            : 0

// Position = spline point + offset (relative or world basis).
destPos        = splineHit.worldPoint + ApplyBasis(offset, splineTangent, isRelative)
state.position = SpringDamp(m_idealPosition, m_springVelocity, destPos, halflife, dt)

// Push FoV to owner via WriteLensFieldOfView so Cam Core picks it up live.
if (fovDest > 0):
    ctx.owner->WriteLensFieldOfView(fovDest)

Authored fields

FieldDefaultPurpose
m_targetModeTransformUsed to compute the closest spline point. Typically Transform.
m_overrideEntity / m_groupTargetNameMode-dependent.
m_splineTrack(entity slot)Entity carrying a SplineComponent.
m_startDataEndpoint A (TrackBodyData).
m_endDataEndpoint B.
m_adoptionPathThreshold5.0 mInheritance: max distance from spline an inbound pose may sit before adoption is rejected.

TrackBodyData

struct TrackBodyData {
    AZ::Vector3 m_offset            = (0, 0, 0);
    bool        m_offsetIsRelative  = false;
    float       m_halflife          = 0.1f;
    float       m_fieldOfView       = 0.0f;   // 0 = don't push lens
};

State inheritance

DirectionBehavior
GetReturns m_idealPosition + world-forward toward cached m_lastTargetPos. No angular state. No pivot (the path is the kinematic reference, not a point).
AdoptPure stash. Evaluate consume block: EnsureSplineResolved, project snap.worldPos via FindClosestWorldPoint. Reject if Euclidean distance to projected point > m_adoptionPathThreshold — prevents teleport-snap when the source sits well off the dolly’s path. Inside threshold: seed m_idealPosition = snap.worldPos, clear spring velocity.

Spline resolution timing

EnsureSplineResolved is lazy — runs on first Evaluate with a valid target. Caches m_spline and m_splineEntity so subsequent ticks don’t re-look-up.


Cross-Variant Summary

VariantDegrees of FreedomDampingPivotInheritance GetInheritance Adopt
DefaultFollowBodyPosition onlySpringNone
OrbitBodyAuthored yaw / pitch / radiusSpringPost-offset targetFull angularDisabled (Get-only)
DynamicOrbitBodyDynamic yaw / pitchSolverPost-offset targetFull angularFull (ANGULAR / POSITION)
LeadingFollowBodyXY band + Z followSolver (band-arc)Post-offset targetworldPos + fwdFacing-seeded standoff
TrackBodySpline-boundSpringNone (path)worldPos + fwdProject + threshold

See Also


Get GS_PhantomCam

GS_PhantomCam — Explore this gem on the product page and add it to your project.