Quantcast
Channel: Community | MonoGame - Latest topics
Viewing all articles
Browse latest Browse all 6821

Off-axis vector 2 rotation

$
0
0

@Hafinator wrote:

I'm trying to rotate a bunch of Vector2s that are off-axis.

The tongue is comprised of 4 sections and I would like them to rotate with the frog.

I know this can be calculated with:
x' = x*cos(angle) - y*sin(angle)
y' = x*sin(angle) + y*cos(angle)

Position += new Vector2(Tongue.DEV_MOMENTUM.X * (float)(Math.Cos(Tongue.DEV_ROTATION) - Tongue.DEV_MOMENTUM.Y * (float)(Math.Sin(Tongue.DEV_ROTATION))), Tongue.DEV_MOMENTUM.X * (float)(Math.Sin(Tongue.DEV_ROTATION) + Tongue.DEV_MOMENTUM.Y * (float)(Math.Cos(Tongue.DEV_ROTATION))));

in the above example Tongue.DEV_MOMENTUM = (1,1).

But the result I get is that each piece rotates around some invisible axis that is nowhere close to what I want.
Result:

If you need any more info just ask, I spent to much time on this and have the feeling that I'm the stupidest member of Monogame community :smiley:

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 6821

Trending Articles