Hello all,
I am developing a glove with flexible sensors which controls the finger movements of the hand model in Unity. I am sending the sensor data via UDP and parsing it in Unity.
When I change the angle on the Y axis (with localEulerAngles as you see below), I expect the thumb finger geometry to change only on the Y axis. But as you see, there is a change in all axes.
What is wrong with this? Can you help me?
Unity Editor
The Code with explanation
Code in text format
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class controller : MonoBehaviour {
public static controller instance;
public float[] newNormalizedValues;
float thumb1Angle;
public GameObject thumb1;
private float thumb1Open = 150;
private float thumb1Close = 100;
void Start () {
instance = this;
Screen.SetResolution(500, 500, false);
}
void Update () {
thumb1Angle = thumb1.transform.localEulerAngles.y;
Debug.Log (thumb1Angle);
float newAngle = (thumb1Open - (thumb1Close - thumb1Open) * udpParser.mcpBas);
Debug.Log (udpParser.mcpBas);
thumb1.transform.localEulerAngles = new Vector3(thumb1.transform.localEulerAngles.x, newAngle, thumb1.transform.localEulerAngles.z);
}
}