public sealed class PossessionSystemKeeps possession honest: forwards each player's intent to the pawn they are driving, points their camera at it, and lets go of pawns that no longer exist.
As a system
- Phase
- Input
- Runs after
- PlayerInputSystem
Remarks
It runs in Input, after PlayerInputSystem, and that is not a shortcut. The thing that reacts to a player's intent is CharacterMovementSystem in FixedUpdate — the next phase. A phase boundary is a hard sync where command buffers play back, so a pawn that gains its MoveIntent here has it before the first fixed step of the same frame. Putting this in EarlyUpdate — the tempting place, because the structural work belongs there — would forward last frame's intent, and the symptom is one frame of input latency that no profiler attributes to a phase choice.
The pawn's intent is a copy, and it is rewritten every frame. Following the PossessedBy edge from inside a movement sweep would turn a sequential walk over a column into two random accesses per entity, to save four copies at the top of the frame. The cost is that a system writing a possessed pawn's intent directly is silently overwritten — which is why the pawn's copy is documented as derived, the way WorldTransform is, and why a pawn nothing possesses is not visited at all.
The camera needs no machinery. A player's ViewTarget shot has its CameraTargets written to whatever the player is driving, unconditionally, every frame. [26](../../../docs/plan/26-virtual-cameras.md)'s director then blends because the answer changed — there is no SetViewTarget, no blend curve to pass, and the write self-heals if anything else clobbers it. A shot carrying a PovAim additionally takes the player's aim, which is the whole of a first-person rig.
Fields and properties (2)
public SystemAccess Accesspublic long ReleasedCountPawns that were let go this frame because they no longer exist.
Methods (2)
public override JobHandle Update(in SystemContext context, JobHandle dependency)Runs the system.
public void Apply(World world, CommandBuffer? commands = null)Runs one pass over every player.
Used by (8)
- PlayerRigThirdPersonShooter
- LocalPlayerSystemTestsVixen.Net.Engine.Tests
- PlayerAllocationTestsVixen.Engine.Tests
- PlayerInputQuantizeSystemVixen.Net.Engine
- PlayerInputQuantizeSystemTestsVixen.Net.Engine.Tests
- PlayerInputTestsVixen.Engine.Tests
- PossessionTestsVixen.Engine.Tests
- RigVixen.Engine.Tests