sin and cos

BlitzPlus Forums/BlitzPlus Programming/sin and cos

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.

Well, the issue is this:

He changes angles in steps of 2, rite?
So, possible values are 8 6 4 2 0 -2 -4 -6 -8.

Next he clips them so that <0 would becomes 359 and >359 would become 0. And there's the problem.

A value of -2 becomes 359. The distance from -2 to 0 = '2', the distance from 359 to 0 = '1', so there's where angle errors come from.

What I would do:

option 1:

		If carangle < 0 Then carangle = 358
		If carangle > 358 Then carangle = 0


But his option is hardcoded for angle-rotations of 2, not
exactly elegant.


option 2: have a 'speed' variable somewhere, with the value '2'.

If KeyDown(203) Then carangle = (carangle + (360-speed)) Mod 360
If KeyDown(205) Then carangle = (carangle + speed) Mod 360


In this solution you can change the speed whenever you want.

'speed' could be any name tho, such as 'angledelta'..