I am trying to make a dial on a machine (similar to ones you may find on a stove), where the user can rotate it, but only on one axis (in this case, the Z axis) and cannot move it from its location. Here is an image of my dial:

It should be noted that the scale of the model is 100, and it is a child of an empty GameObject whose scale is 1, which is a child of a model whose scale is 0.0075.
Here is the code I have so far:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Valve.VR.InteractionSystem;
[RequireComponent(typeof(Interactable))]
public class Dial914 : MonoBehaviour
{
Hand playerHand;
[SerializeField] Rigidbody dial;
// Use this for initialization
void Start()
{
}
private void HandAttachedUpdate()
{
dial.MoveRotation(Quaternion.Euler(0, 0, -playerHand.transform.rotation.z * transform.localScale.z)); //I actually don't know why we have to negate the hand rotation here, but it works
}
protected virtual void OnAttachedToHand(Hand hand)
{
playerHand = hand;
}
}
This mostly works, but you can only rotate it halfway around and it starts to get buggy if you try to go further than that.
Here is a gfycat of the result:
Found the answer:
Vector3 eulerRotation = new Vector3(0, 0, playerHand.transform.eulerAngles.z);
transform.rotation = Quaternion.Euler(eulerRotation);
@toxxicxmodz Hello! Can you go into a little more detail on how you ended up getting this working correctly. I’ve been struggling trying to get an accurate working dial for some time now. I tried your above code and it still produced an odd result… it would stop rotating after a certain point… plus the dial is always reset in this case to the position of the hand when ever you grab it again… finally… if you actually move your hand around (side to side, up and down) it will cause the dial to spin as well.
Really wanting an easy way to use the SteamVR Interaction System with a Dial. Very surprised this isnt an included script.
@toxxicxmodz Hello! Can you go into a little more detail on how you ended up getting this working correctly. I’ve been struggling trying to get an accurate working dial for some time now. I tried your above code and it still produced an odd result… it would stop rotating after a certain point… plus the dial is always reset in this case to the position of the hand when ever you grab it again… finally… if you actually move your hand around (side to side, up and down) it will cause the dial to spin as well.
Really wanting an easy way to use the SteamVR Interaction System with a Dial. Very surprised this isnt an included script.