Move scripts under Assets/Scripts/ into Components, GameMode, Helper, Network, Enum, Struct and ScriptableObject folders. Pure file moves (plus folder .meta files); no code changes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
22 lines
710 B
C#
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;
|
|
}
|
|
}
|