mirror of
https://udrimavric.com/MAVRIC/Stratasys-450mc-VR.git
synced 2025-01-22 23:28:43 -05:00
b4656bf24a
added the missing watch texture and corrected the watch orientation
25 lines
834 B
C#
25 lines
834 B
C#
using UnityEngine;
|
|
|
|
public class AttachWatchToHand : MonoBehaviour
|
|
{
|
|
public Transform handTransform; // Assign the hand's transform
|
|
public Vector3 watchOffsetPosition; // Offset from the hand for watch positioning
|
|
public Vector3 watchOffsetRotation = new Vector3(0, 0, -90);
|
|
|
|
void Update()
|
|
{
|
|
|
|
if (handTransform != null)
|
|
{
|
|
Quaternion rotation = Quaternion.Euler(handTransform.rotation.eulerAngles + watchOffsetRotation);
|
|
|
|
// Update the watch position and rotation to follow the hand
|
|
transform.position = handTransform.position + handTransform.TransformDirection(watchOffsetPosition);
|
|
transform.rotation = rotation;
|
|
}
|
|
else
|
|
{
|
|
Debug.LogWarning("Hand transform not assigned!");
|
|
}
|
|
}
|
|
} |