mirror of
https://github.com/ConjureETS/MTI860_VR_Multi_Controller.git
synced 2026-03-24 20:41:14 +00:00
20 lines
548 B
C#
20 lines
548 B
C#
using UnityEngine;
|
|
|
|
namespace JoyCon
|
|
{
|
|
public class JoyConRotationFollow : JoyConBehaviour
|
|
{
|
|
[SerializeField] private Transform ObjectParent;
|
|
[SerializeField] private Transform ObjectToRotate;
|
|
|
|
private void Update()
|
|
{
|
|
Joycon j = JoyConManager.GetJoycon(JcArmInd);
|
|
if (j.GetButtonDown(Joycon.Button.SHOULDER_2))
|
|
{
|
|
j.Recenter();
|
|
}
|
|
ObjectToRotate.eulerAngles = ObjectParent.eulerAngles + j.GetVector().eulerAngles;
|
|
}
|
|
}
|
|
} |