Skip to main content

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.

Constructors​

MemberWhat it is
NetworkedIKBody()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

MemberWhat it is
static AccumulativeAverageCount prepareForWriteTimerShared timing stats for PrepareForWrite.
static AccumulativeAverageCount serializeTimerShared timing stats for Serialize.
11 private and internal fields
MemberWhat it is
private float angleThresholdDotQuaternion dot below which a bone counts as changed.
private CharacterIKController characterIKControllerIK controller on the parent character.
private CharacterDummyPointer dummyCharacter dummy whose bones are synced.
private float fixedUpdateLerpTimeBlend factor per update toward received rotations.
private BoneIdentifier[] ikBoneIdentifiersWhich bones to sync.
private Transform[] ikBonesBone transforms being synced.
private bool isInitializedSet by Initialize; not otherwise used.
private bool[] isSendingBonesPer bone flags for which ones go in the next write.
private Quaternion[] latestRotationsCurrent rotation per bone: recorded on the local player, blended on others.
private float maxAngleDifferenceUnused.
private Quaternion[] targetRotationsLast sent or received rotation per bone.

Properties​

MemberWhat it is
NetworkEntity Entity { get; set; }The network entity.
3 private and internal properties
MemberWhat 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​

MemberWhat 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
MemberWhat 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.