Rotation Backwards?

Monkey Forums/Monkey Programming/Rotation Backwards?

therevills(Posted 2011) [#1]
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:



Yahfree(Posted 2011) [#2]
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



therevills(Posted 2011) [#3]
**** duplicate post ****


therevills(Posted 2011) [#4]
Yeah Ive altered the Monkey code to "fix" this, but is it a bug or is it BlitzMax that is backwards?


DGuy(Posted 2011) [#5]
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.


therevills(Posted 2011) [#6]
Ive tried both global and local:



Both looks backwards to me???


DGuy(Posted 2011) [#7]
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.


therevills(Posted 2011) [#8]
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...


Jesse(Posted 2011) [#9]
No Blitzmax is clockwise from right. 0 degrees is at 3 o'clock on Blitzmax.


therevills(Posted 2011) [#10]
0 degrees is at 3 o'clock on Blitzmax.


Yep, my mistake - ta!