Table of Contents

Class CharacterAimOrigin

Namespace
FishMMO.Shared
Assembly
FishMMO.Shared.dll

Derives the point a character aims from, out of state the server already owns.

public static class CharacterAimOrigin
Inheritance
CharacterAimOrigin
Inherited Members

Remarks

Why this is not sent. The aim origin used to travel as CharacterReplicateData.CameraPosition — three raw floats, taken from the owning client verbatim. It reached ITargetController.UpdateTarget, which the server raycasts from, and AbilityObject.Spawn, which places the hitbox, without ever being compared against the caster's own position. A modified client therefore chose the point the server searched for victims from, and an ability's range was measured from that point rather than from the character, so any target anywhere in the scene was reachable. Deriving the origin here closes that by construction: there is no longer a field to lie in.

Why it stays deterministic. Every peer computes this from the motor's transient position, which reconcile already keeps in agreement, and KCCPlayer (Order 80) runs before AbilityController (Order 100), so the motor has been advanced for the current tick before the origin is read. The ability simulation is deterministic and reads this on every peer, so it must not consult anything frame-rate dependent or client-local.

What changes for players. Aim now originates at the character's eye rather than at the camera, which in third person sits behind and above. Direction is unaffected — that is still the camera forward, quantised by AimDirectionCompression. The visible difference is at close range and around cover: a character can no longer shoot from a vantage point its body does not occupy. That is the intended behaviour for a server-authoritative game, not a regression.

Methods

Resolve(ICharacter)

Returns the world-space point character aims from.

public static Vector3 Resolve(ICharacter character)

Parameters

character ICharacter

The character casting. May be null.

Returns

Vector3

The aim origin in world space.

Remarks

Handles both kinds of character through one call, which is what keeps a player and an NPC resolving their origin the same way. A player has a KCC motor and its capsule gives a crouch-aware eye. An NPC has none — it moves under a NavMeshAgent — so its origin comes off the transform, which every peer already holds via its NetworkTransform. In neither case is anything read from the owning client.

Resolve(KinematicCharacterMotor, Transform)

Returns the world-space point motor's character aims from.

public static Vector3 Resolve(KinematicCharacterMotor motor, Transform fallbackTransform)

Parameters

motor KinematicCharacterMotor

The character's motor. May be null.

fallbackTransform Transform

Used when there is no motor. May be null.

Returns

Vector3

The aim origin in world space.