Files
ui/Assets/BlockJointController.cs
2026-03-08 21:39:00 -04:00

26 lines
598 B
C#

using UnityEngine;
using UnityEngine.UI;
public class BlockJointController : MonoBehaviour
{
public Transform rotatingCap;
public Slider angleSlider;
public Text angleLabel;
private float currentAngle = 0f;
void Start()
{
angleSlider.onValueChanged.AddListener(OnAngleChanged);
angleSlider.value = 0;
}
void OnAngleChanged(float value)
{
currentAngle = value;
angleLabel.text = $"Angle: {value:F0}°";
if (rotatingCap != null)
rotatingCap.localRotation = Quaternion.Euler(0, value, 0); // rotate Y
}
}