mirror of
https://udrimavric.com/MAVRIC/Stratasys-450mc-VR.git
synced 2025-01-22 07:09:01 -05:00
Fixed watch left wrist orientation
fixed the watch orientation on the left hand so it faces the right way
This commit is contained in:
parent
3f5c7ab5e9
commit
2e28950d97
@ -48,8 +48,8 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
handTransform: {fileID: 0}
|
||||
watchOffsetPosition: {x: 0, y: 0, z: 0}
|
||||
watchRightOffsetRotation: {x: 0, y: 0, z: -90}
|
||||
watchLeftOffsetRotation: {x: 0, y: 0, z: 90}
|
||||
watchRightOffsetRotation: {x: 0, y: -90, z: -90}
|
||||
watchLeftOffsetRotation: {x: 0, y: 90, z: -90}
|
||||
leftHand: {fileID: 0}
|
||||
rightHand: {fileID: 0}
|
||||
--- !u!114 &1125641476039870382
|
||||
|
@ -4,8 +4,8 @@ public class AttachWatchToHand : MonoBehaviour
|
||||
{
|
||||
public Transform handTransform; // Assign the hand's transform
|
||||
public Vector3 watchOffsetPosition; // Offset from the hand for watch positioning
|
||||
public Vector3 watchRightOffsetRotation = new Vector3(0, 0, -90);
|
||||
public Vector3 watchLeftOffsetRotation = new Vector3(0, 0, 90);
|
||||
public Vector3 watchRightOffsetRotation = new Vector3(0, -90, -90);
|
||||
public Vector3 watchLeftOffsetRotation = new Vector3(0, 90, -90);
|
||||
|
||||
|
||||
public Transform leftHand;
|
||||
@ -13,26 +13,21 @@ public class AttachWatchToHand : MonoBehaviour
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (handTransform == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Quaternion rotation = Quaternion.Euler(handTransform.rotation.eulerAngles);
|
||||
|
||||
// Update the watch position and rotation to follow the hand
|
||||
transform.position = handTransform.position + handTransform.TransformDirection(watchOffsetPosition);
|
||||
transform.rotation = rotation;
|
||||
|
||||
if (handTransform != null && handTransform == rightHand)
|
||||
transform.GetChild(0).localRotation = Quaternion.Euler(watchRightOffsetRotation);
|
||||
|
||||
if (handTransform == leftHand)
|
||||
{
|
||||
Quaternion rotation = Quaternion.Euler(handTransform.rotation.eulerAngles + watchRightOffsetRotation);
|
||||
|
||||
// Update the watch position and rotation to follow the hand
|
||||
transform.position = handTransform.position + handTransform.TransformDirection(watchOffsetPosition);
|
||||
transform.rotation = rotation;
|
||||
}
|
||||
else if (handTransform != null && handTransform == leftHand)
|
||||
{
|
||||
Quaternion leftRotation = Quaternion.Euler(handTransform.rotation.eulerAngles + watchLeftOffsetRotation);
|
||||
|
||||
// Update the watch position and rotation to follow the hand
|
||||
transform.position = handTransform.position + handTransform.TransformDirection(watchOffsetPosition);
|
||||
transform.rotation = leftRotation;
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning("Hand transform not assigned!");
|
||||
transform.GetChild(0).localRotation = Quaternion.Euler(watchLeftOffsetRotation);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user