Answers for "angle from vector"

2

angle to vector2

var direction = Vector2(cos(angle), sin(angle))
Posted by: Guest on May-22-2021
1

vector from angle

# to get a vector from an angle, implement something like the code below:

vector = Vector2(cos(theta), sin(theta))

# if this doesn't give accurate results, check whether you are using the right
# angle units for the function (degs or rads) and if it is flipped around the
# mirror line y=x swap the cos ans sin functions.
Posted by: Guest on September-09-2021

Browse Popular Code Answers by Language