My script currently gets the local Euler Angle of a game object, and i need to convert that into a vector 3.
Funny thing is, this math worked on a completely separate demo, but now i am getting funny results in a new project.
If i use this script on an object set to 0 degrees, it moves correctly. If i change it by 90 degrees, it moves at 180 degrees instead of 90.
I have tried some of the other functions unity has for moving towards an angle, but i can never get them to work.
float moveDirection = gameObject.transform.localEulerAngles.z;
Debug.Log ("movement direction is" + moveDirection);
float moveSpeed = spawnerMoveSpeed;
Debug.Log ("movement speed is" + moveSpeed);
float xMove = Mathf.Cos (Mathf.Deg2Rad * moveDirection);
float yMove = Mathf.Sin (Mathf.Deg2Rad * moveDirection);
Vector3 thatWay = new Vector3 (xMove, yMove, 0);
transform.Translate (thatWay * moveSpeed * Time.deltaTime);