I've made a mini-tutorial on BMax angles

Miscellaneous Forums/General Discussion/I've made a mini-tutorial on BMax angles

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Probably have to edit the top post soon as new info comes in... As big10p questioned and John Pickford confirmed, Sin and Cos DO work the same as in maths where 0 degrees is on the Positive X axis.

here's some example code:

Strict

Graphics 800,600,0

Global image:TImage = LoadImage("header.png")
MidHandleImage(image)

Global radius=100
Global x = 400
Global y = 300
Global a:Float=0
While Not KeyHit(KEY_ESCAPE)
	Cls
	Plot x+radius*Cos(a),y+radius*Sin(a)		
	SetRotation a
	DrawImage Image,x,y
	SetRotation 0
	a:+1
	If a>360 Then a:-360
	Flip
Wend


My cock up was basically I had loaded in an arrow pointing up, and that was the image I was rotating and I wanted the ball to fire in the direction it was pointing. When drawn at 0 rotation the arrow points up, yet all my calcs made the ball fly off to the side and I thought "weird" so I rejigged the cos and sin to account for the 90 degree offset :-) Then I kinda assumed BMax rotation started at the top as it seemed logical when I was thinking about the arrow graphics haha, when in fact it starts on the positive X axis.

[edit]I just changed the code where I fired the ball to x=cos(arrowangle-90) and y = sin(arrowangle-90) and it works fine :-)