Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

the_visualist

Member Since 11 Oct 2011
Offline Last Active May 07 2013 06:29 AM
-----

#4903738 Point relative to moving Origin

Posted by the_visualist on 17 January 2012 - 01:43 PM

Right so now I've got:

point1 = Vector2.Transform(point1, Matrix.CreateRotationZ(angle));
point1 += origin;

Where point1 is the fixed point, and the origin is the well, origin. But this doesn't appear to do anything.


What you need to do is rotate something about the triangles origin. The something is your FixedPoint in relation to the triangles Origin, which means:
Vector something = FixedPoint - Origin; (this is called translation by the way)
Rotate(something, angle);

Afterwards you need to translate it back to where it was to get the correct coordinates:
Vector newFixedPoint = something + origin

Here is the matrix that you need for the rotation - to make sure that you are actually using the correct one: Posted Image

the_visualist


PARTNERS