Files
chameleon/Assets/Scripts/CharacterTeleport.cs
T
adminandClaude Fable 5 2243cc823e Refactor: extract shared helpers across scripts, trim remaining doc redundancy
Deduplication pass (44 extractions):
- New SmoothedLook: shared smoothed yaw/pitch look tick + view seeding
  (FirstPersonController, FreeCamController)
- New CharacterTeleport: disable-CC-around-teleport idiom (rescue,
  owner position apply, free-cam sync)
- New GeometryUtil: RescaleToUnitScale + TransformBounds (concealment
  meter/volume, skinned collider baker)
- Paint family: canonical map read/write shared between Net and
  Persistence, snapshot decode, backend stroke dispatch, RebuildBackend,
  ResolveSeed, chunked RPC send/gate/copy, CamoKnobs/HeightKnobs
  aggregates, SanitizeFileKey, NewMaskTexture, AdoptAlbedo, FindSlider
- Player/modes: GameMode SetPlayerControl/SetPainting/SetOrbitInputEnabled,
  InputUtil.GameplayKeyPressed, NearestClimbHit, ComputeXRay delegates to
  ComputeResolutionFreeze, FingerIK TryInPlaneAngle
- Match/misc: UnhookSessionCallbacks, SendEmptyNamedMessage, SwapScenes,
  RunSessionOpAsync, CovarianceEigen, CollectClusterPoints, MatchHud
  GUIStyle cache, HsvColorPicker rehook, VoxelCenter

Documentation pass: remove 6 triplicated doc blocks and 2 restating
inline comments left after the previous reduction.

Behavior-neutral; hot-path rasterizer loops intentionally untouched.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 12:33:48 +02:00

22 lines
710 B
C#

using UnityEngine;
/// <summary>Disables a CharacterController around a transform write so it cannot snap the transform back.</summary>
public static class CharacterTeleport
{
public static void Move(CharacterController cc, Transform t, Vector3 position)
{
bool reenable = cc && cc.enabled;
if (cc) cc.enabled = false;
t.position = position;
if (cc) cc.enabled = reenable;
}
public static void Move(CharacterController cc, Transform t, Vector3 position, Quaternion rotation)
{
bool reenable = cc && cc.enabled;
if (cc) cc.enabled = false;
t.SetPositionAndRotation(position, rotation);
if (cc) cc.enabled = reenable;
}
}