NetworkedIKBody
A class in Root.Township, the global namespace.
Syncs a player's IK bone rotations from the local player to everyone else, who blend toward them each character update.
- Listed in Global namespace: M to O
- Inherits or implements
CharacterComponentController,INetworkSerialized,INetworkEntityBehaviour,IInitializeAsLocalPlayer
Constructors
| Member | What it is |
|---|---|
NetworkedIKBody() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
| Member | What it is |
|---|---|
static AccumulativeAverageCount prepareForWriteTimer | Shared timing stats for PrepareForWrite. |
static AccumulativeAverageCount serializeTimer | Shared timing stats for Serialize. |
11 private and internal fields
| Member | What it is |
|---|---|
private float angleThresholdDot | Quaternion dot below which a bone counts as changed. |
private CharacterIKController characterIKController | IK controller on the parent character. |
private CharacterDummyPointer dummy | Character dummy whose bones are synced. |
private float fixedUpdateLerpTime | Blend factor per update toward received rotations. |
private BoneIdentifier[] ikBoneIdentifiers | Which bones to sync. |
private Transform[] ikBones | Bone transforms being synced. |
private bool isInitialized | Set by Initialize; not otherwise used. |
private bool[] isSendingBones | Per bone flags for which ones go in the next write. |
private Quaternion[] latestRotations | Current rotation per bone: recorded on the local player, blended on others. |
private float maxAngleDifference | Unused. |
private Quaternion[] targetRotations | Last sent or received rotation per bone. |
Properties
| Member | What it is |
|---|---|
NetworkEntity Entity { get; set; } | The network entity. |
3 private and internal properties
| Member | What it is |
|---|---|
private int Alta.Networking.INetworkSerialized.MaximumBits { get; } | 33 bits per IK bone. |
private AccumulativeAverageCount Alta.Networking.INetworkSerialized.PrepareForWriteTimer { get; } | Returns the shared prepareForWriteTimer. |
private AccumulativeAverageCount Alta.Networking.INetworkSerialized.SerializeTimer { get; } | Returns the shared serializeTimer. |
Methods
| Member | What it is |
|---|---|
void Initialize() | Marks the component initialized. |
void InitializeAsServer(SpawnData spawnData) | Empty. |
void OnConnected(Player player) | Empty. |
void OnDisconnected(Player player) | Empty. |
bool PrepareForWrite(bool isWriteFull) | Picks the bones that moved past the angle threshold; always true for a full write. |
void Serialize(Stream stream, bool isWriteFull) | Writes or reads the bone rotations (all on a full write, else only changed ones with a flag each). |
override void UpdateCharacterComponent() | Local player: records bone rotations. Others: blends toward the received ones. |
3 private and internal methods
| Member | What it is |
|---|---|
private void Awake() | Maps the bone IDs to transforms and sets up the rotation arrays. |
private void HandleRemote() | Blends each bone toward its received rotation, inside the IK controller's pre and post IK calls. |
private void IInitializeAsLocalPlayer.InitializeAsLocalPlayer(PlayerController player) | Marks this body as the local player's, so it sends instead of receives. |