Rotation Backwards?
Monkey Forums/Monkey Programming/Rotation Backwards?
| ||
When I rotate using the drawImage rotation parameter its seems backwards... When I rotate my ship by adding to rotation, in Monkey it rotates left, in BlitzMax it rotates right... I am doing something wrong? BlitzMax code: Monkey code: |
| ||
I use these functions for rotation:Function SetRotation (X:Float, Y:Float, angle:Float) PushMatrix Translate X, Y Rotate angle Translate -X, -Y End Function ResetRotation () PopMatrix End |
| ||
**** duplicate post **** |
| ||
Yeah Ive altered the Monkey code to "fix" this, but is it a bug or is it BlitzMax that is backwards? |
| ||
I believe it's because the code is using global transformations in BlitzMax, but local transformations in Monkey. Monkey has global (affects all) and local (affects one) transformations, while BlitzMax only has global transformations: BlitzMax Global Transformations (Max2D): ---------------------------------------- SetRotation SetScale SetTransform Monkey Global Transformations (mojo): ------------------------------------- Rotate Scale SetMatrix Transform Translate Monkey Local Transformations (mojo): ------------------------------------ DrawImage => the rotation, scaleX, scaleY parameters DrawImageRect => the rotation, scaleX, scaleY parameters Try using mojo.Rotate instead of the DrawImage rotation parameter; that should give the effect your expecting. |
| ||
Ive tried both global and local: Both looks backwards to me??? |
| ||
Hmmm, ... guess we need some clarification on what direction of rotation to expect from a positive angle. Currently, a positive angle is producing a counter-clockwise rotation. |
| ||
http://en.wikipedia.org/wiki/Rotation_(mathematics) Mathematically, using a positive angle it's counter clockwise from right, in Blitzmax it's clockwise from top. I guess we are doing it the proper way now... |
| ||
No Blitzmax is clockwise from right. 0 degrees is at 3 o'clock on Blitzmax. |
| ||
0 degrees is at 3 o'clock on Blitzmax. Yep, my mistake - ta! |