I’m trying to rotate several points (vector2s) around an origin.
In order to do this I want to get the direction from the origin to a certain point first:
for (int i = 0; i < points.Count; ++i) {
Vector2 dir = points *- start;*
- print (start);*
_ print (points*);_
print (dir);
_}_
Here’s where I create start:
private void createStart() {
start = new Vector2 (Random.value * 0.5f + 0.25f, Random.value * 0.5f + 0.25f);
_}_
And here’s where I create the points (or in this case, just one for testing purposes, nPoints is set to one in the inspector):
private void createPoints() {
_ points.Clear ();_
_ for (int i = 0; i < nPoints; ++i) {_
_ float px = start.x + Random.value * 0.4f - 0.2f;
float py = start.y + Random.value * 0.4f - 0.2f;_
_ Vector2 newPoint = new Vector2(px, py);_
_ points.Add (newPoint);_
_ }_
_}_
and finally, this is what unity prints:
_[40717-unityweird.png*|40717]*
_*
so my start, origin, is at (0.4, 0.5), my point is at (0.3, 0.3) and the difference is (-0.2, -0.2).
im sure im missing something stupid here, but i cant find it