mirror of
https://github.com/BotChain-Robots/ui.git
synced 2026-07-08 15:07:22 +02:00
switch from Unity version control to git
This commit is contained in:
27
Assets/BlockJointController.cs
Normal file
27
Assets/BlockJointController.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
|
||||
public class BlockJointController : MonoBehaviour
|
||||
{
|
||||
public Transform rotatingCap;
|
||||
public Slider angleSlider;
|
||||
public TextMeshProUGUI 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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user