Files
beyond/Assets/Scripts/Utils/RotationDebugger.cs

37 lines
1.3 KiB
C#

using UnityEngine;
using Invector.vCharacterController; // Required to get access to the controller
public class RotationDebugger : MonoBehaviour
{
private vThirdPersonController cc;
private GUIStyle style;
void Start()
{
cc = GetComponent<vThirdPersonController>();
// Setup for on-screen display
style = new GUIStyle();
style.fontSize = 18;
style.fontStyle = FontStyle.Bold;
style.normal.textColor = Color.white;
}
void OnGUI()
{
if (cc == null) return;
// Create a semi-transparent background box
GUI.Box(new Rect(10, 10, 350, 140), "");
// Display critical information on screen
string debugText = "--- ROTATION DEBUG ---";
debugText += $"\nRotation: {transform.rotation.eulerAngles.ToString("F2")}";
debugText += $"\nIs Rolling: {(cc.isRolling ? "<color=green>True</color>" : "<color=red>False</color>")}";
debugText += $"\nLock Rotation: {(cc.lockRotation ? "<color=red>True</color>" : "<color=green>False</color>")}";
debugText += $"\nAnimator Root Motion: {(cc.animator.applyRootMotion ? "<color=green>True</color>" : "<color=red>False</color>")}";
style.richText = true;
GUI.Label(new Rect(15, 15, 340, 130), debugText, style);
}
}