Answers for "rotation transformation 2d"

C#
1

get 2d rotation from 2 position math

Vector3 dir = new Vector3(position2.x - position1.x, position2.y - position1.y);
float angle = Mathf.Atan2(dir.y, dir.x) * Mathf.Rad2Deg;
Quaternion rotation = Quaternion.Euler( 0f, 0f, angle );
Posted by: Guest on February-13-2021
0

2d rotation code graphics

(-100, 100), (-200, 150), (-200, 200), (-150, 200)
Posted by: Guest on January-01-2022

C# Answers by Framework

Browse Popular Code Answers by Language