Hello all,
I am working on getting values in euler angles which is an array of 3 elements double Euler= double new Euler [3]
that will be updated in the Update Function, In the console I can see the values constantly changing. Is there any way I can access these values. for example
I want to set a condition in the update,
if (previous euler angle > next euler angle )
{
Do Something;
}
I know that, the update function updates once/frame so how can I get the euler angle values in the previous frame. Could you please help?
This might help. Check once!
Vector3 cur_angle; // angle from current frame
Vector3 prev_angle; // angle from previous frame
// Start is called before the first frame update
private void Start()
{
prev_angle = transform.eulerAngles;
cur_angle = transform.eulerAngles;
}
// Update is called once per frame
void Update()
{
cur_angle = transform.eulerAngles;
func(cur_angle);
}
void func(Vector3 cur_angle)
{
if(prev_angle.z > cur_angle.z)
{
//Do something
}
prev_angle = cur_angle;
}