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:
46
Assets/ServoBendModule.cs
Normal file
46
Assets/ServoBendModule.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using UnityEngine;
|
||||
public class ServoBendModule : ServoMotorModule
|
||||
{
|
||||
public override string servoType => "Servo1";
|
||||
|
||||
void Start()
|
||||
{
|
||||
// SetAngle(currentAngle, false);
|
||||
// SetHighlight(false);
|
||||
// currentAngle = 90f;
|
||||
// lastSentAngle = 90f;
|
||||
}
|
||||
|
||||
public override void MoveArmPivot(float currentAngle)
|
||||
{
|
||||
float relativeAngle = currentAngle - 90f;
|
||||
armPivot.localRotation = Quaternion.Euler(0f, 0f, relativeAngle);
|
||||
}
|
||||
|
||||
public override void SetAngle(float angle)
|
||||
{
|
||||
currentAngle = Mathf.Clamp(angle, 0f, 180f);
|
||||
MoveArmPivot(currentAngle);
|
||||
}
|
||||
|
||||
public override void InitialSetAngle(float angle)
|
||||
{
|
||||
currentAngle = Mathf.Clamp(angle, 0f, 180f);
|
||||
lastSentAngle = currentAngle;
|
||||
float relativeAngle = currentAngle - 90f;
|
||||
armPivot.localRotation = Quaternion.Euler(0f, 0f, relativeAngle);
|
||||
}
|
||||
|
||||
// public void SetHighlight(bool enabled)
|
||||
// {
|
||||
// if (highlightVisual != null)
|
||||
// {
|
||||
// highlightVisual.SetActive(enabled);
|
||||
// Debug.Log($"[Highlight] {(enabled ? "Enabled" : "Disabled")} for {name}");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// Debug.LogWarning($"[Highlight] No highlightVisual assigned on {name}");
|
||||
// }
|
||||
// }
|
||||
}
|
||||
Reference in New Issue
Block a user