Re: need help with rotation x,y math
-- Dynasoft
Well spotted indeed. I thought after about doing an edit to say "Hey, did you realise that both lines are NewX = ..."
Having said that I will still need a translation of
Quote:
You're using the *new* X coordinate in the line where you figure out the new Y, it should be the old X.
your orig post....
NewX = Cos(E) * (X-Xo) + Sin(E) * (Y-Yo) + Xo
NewX = Cos(E) * (Y-Yo) - Sin(E) * (X-Xo) + Yo
The other thing I wondered about was bracketing.
Here is a sample of how I thought brackets should be added to be sure the calcs are done in order - I have added {}
NewX = {Cos(E) * (X-Xo)} + {Sin(E) * {(Y-Yo) + Xo}}
Light and movement are what, for me, makes a screen interesting. Poor play can never really be compensated for but giving time to visuals is worth the effort.
Thanks for following this.
Re: need help with rotation x,y math
Quote:
Originally Posted by arfa
Well spotted indeed. I thought after about doing an edit to say "Hey, did you realise that both lines are NewX = ..."
Quote:
Originally Posted by Dynasoft
NewX = Cos(E) * (X-Xo) + Sin(E) * (Y-Yo) + Xo
NewX = Cos(E) * (Y-Yo) - Sin(E) * (X-Xo) + Yo
Whoops, that should indeed be NewY for the 2nd one:
NewX = Cos(E) * (X-Xo) + Sin(E) * (Y-Yo) + Xo
NewY = Cos(E) * (Y-Yo) - Sin(E) * (X-Xo) + Yo
Quote:
Originally Posted by arfa
The other thing I wondered about was bracketing.
Here is a sample of how I thought brackets should be added to be sure the calcs are done in order - I have added {}
NewX = {Cos(E) * (X-Xo)} + {Sin(E) * {(Y-Yo) + Xo}}
The bracketing is:
NewX = { {Cos(E) * (X-Xo)} + {Sin(E) * (Y-Yo)} } + Xo
NewY = { {Cos(E) * (Y-Yo)} - {Sin(E) * (X-Xo)} } + Yo
(You shouldn't need the extra {} though, MMF will get the order right)
Quote:
Originally Posted by arfa
Having said that I will still need a translation of
Quote:
You're using the *new* X coordinate in the line where you figure out the new Y, it should be the old X.
You are setting the X position to the first calculation, then retrieving that new X position for the Y calculation, so you end up with this:
NewX = Cos(E) * (X-Xo) + Sin(E) * (Y-Yo) + Xo
NewY = Cos(E) * (Y-Yo) - Sin(E) * (NewX-Xo) + Yo
You need to either store the old X and Y and then do both calculations using the stored values, or do the calculations into stored values and then set position.
Re: need help with rotation x,y math
Ahhhh, the tangled tumour that is literature of more than one brain. If you follow my converse perversity juxtaposed against the corollary of my second cat's first litter.
> > s cattered.
Quote:
NewX = Cos(E) * (X-Xo) + Sin(E) * (Y-Yo) + Xo
NewY = Cos(E) * (Y-Yo) - Sin(E) * (NewX-Xo) + Yo
This makes it quote clare.
Thanks for the quick reply. I will see about putting this into a working example.
Re: need help with rotation x,y math
I wonder if you are still following this HolyMonkey?
I wonder if your original question was to actually position the object - as opposed to predicting it XY *before* rotation? I would be interested to know your game scenario if it is the predictive type.
Assuming it is not - and, for me I imaging most games as "move, jump, collide, etc and see what happens" - then here are a couple of examples using a simple circumference formula that I found while trying to get my head around the predictive math.
http://www.buddhamind.info/mmf/AK_arc_test-2.mfa
@Dynasoft - ouch.! I can't get this sucker to work for me
@Pixelthief - MMF doesn't allow -Sin
@both... I am still interested to follow this. I wonder if you had the time to put a working model together?
thanks - ak
Re: need help with rotation x,y math
Yes, I'm still following this, but its not for a game... its just to be able to create one "thing" from several images near each other, then cohesively rotate the entire thing without it getting "ripped apart" Dynasoft's first equations worked perfectly for me. I figured that the second one was meant to read "new Y". :)
Re: need help with rotation x,y math
When you want to type
-Sin(Alterable Value A("Object"))
Instead just type:
0-Sin(Alterable Value A("Object"))
:S
Re: need help with rotation x,y math
Yeah, MMF doesn't support unary minus, except for negative numbers.
Re: need help with rotation x,y math
yeah I keep forgetting to say something
Hey, clickteam. Add unary minus symbols to your parser! They're not *all* binary operators. Its almost 2011!
Re: need help with rotation x,y math
>> Dynasoft's first equations worked perfectly for me
Could you post a simple example of that?
Re: need help with rotation x,y math
I will as soon as I get the time to make one...which might not be until some time this weekend...