Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Angles

Author
Message
pr0fess0r cha0s
16
Years of Service
User Offline
Joined: 6th Oct 2008
Location:
Posted: 25th Apr 2009 07:37
I have noticed that the coordinate system in Dark Basic stuff seems odd. I get strange angles when retrieving an objects angle. If plotted on a graph, the top terminal is 0 instead of 90 degrees. The next terminal to the right (clockwise) is 90 instead of 0. The next terminal is 180 instead of 270. The next is 270 instead of 180. Are the trig functions sin, cos, tan, arc sin, arc cos, arc tan adjusted accordingly, or not? I am trying to move an object sideways exactly. This requires the use of these functions. It doesn't work. Even though there are simpler ways to do this, I still really need to learn to use the angle math for other situations as well. Is this strange angle system the cause of my malfunctioning program? Has anyone else run in to this problem? If so what solutions have you found?

Here is a simple program that rotates a cube to illustrate my problem.


#include "DarkGDK.h"

void DarkGDK ( void )
{
dbSyncOn ( );
dbSyncRate ( 60 );
dbMakeObjectCube(1, 10);
while ( LoopGDK ( ) )
{
if ( dbLeftKey ( ) )
dbRotateObject ( 1, dbObjectAngleX ( 1 ), dbWrapValue(dbObjectAngleY ( 1 ) - 1), dbObjectAngleZ ( 1 ));
if ( dbRightKey ( ) )
dbRotateObject ( 1, dbObjectAngleX ( 1 ), dbWrapValue(dbObjectAngleY ( 1 ) + 1), dbObjectAngleZ ( 1 ));
dbText (10, 10, dbStr(dbObjectAngleY (1)));
// here we make a call to update the contents of the screen
dbSync ( );
}
// before quitting delete our objects
dbDeleteObject ( 1 );
// and now everything is ready to return back to Windows
return;
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 25th Apr 2009 11:54 Edited at: 25th Apr 2009 11:57
And you don't need to triple post the same problem...

edit:
Quadruple post!

Login to post a reply

Server time is: 2024-11-25 13:14:41
Your offset time is: 2024-11-25 13:14:41