I’m making a 2d game where Objects are constantly moving forward with a magnitude of 1 for simplicity sake lets assume ( 0 , 1 ) vector that is in the y direction . now I want the user to be able to rotate the Objects as they are moving by transform.Rotate(0,0,z) and I want the direction of the movement to change such that if angle = 45 then I want the object to move .5 in both x and y and if angle = 90 then I want the object to move only in the x direction, how can I achieve that, do I use the physics system?
Ever heard of the unit Circle?
https://www.geogebra.org/files/00/00/13/58/material-135834.png?v=1443252338
Yup you can calculate what the corresponding x and y values are if you know what the angle is:
the x value = cos(rad)
the y value = sin(rad)
if you get your angle in degrees you can use
Deg2Rad for conversion purposes
then input the angle in rads in the cos and sin function
so this:
float angle = transform.Rotation.z; //gets the current rotation in degrees
float rad = angle * Deg2Rad; //converts to rads
float speed = 4.0f; //the speed of the object
Vector2 velocity = new Vector2(Mathf.Cos(rad)*speed,Mathf.Sin(rad)*speed); //calculates new vector.
good luck.