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 / Rotation

Author
Message
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 29th Sep 2009 13:57 Edited at: 29th Sep 2009 13:58
Hello guys

im having a rotation problem:
for example: when my object is rotated by 90 degree on the Y axis, the behavior of rotation around the X axis is the same as the Z axis.

im working on a new game, and trying to find a way to rotate my spaceship around the axes so it looks neat, so in each loop, if the X axis of the spaceship is more than 0, it rotates by -0.1 degree, and if its less, it rotates by 0.1 degree, that happens when im not pressing any button, when i press A or D it should rotate on the Z axis by 0.4 or -0.4, and it also -should- move to the left or to the right slightly along with the Z rotation, and here is the problem, when i move it on the Y axis while it's rotated on the Z axis it changes it's direction in such a weird way.
here is my rotation code:


What im doing wrong, oh well i know what is wrong but how to fix it?

dark coder
22
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 29th Sep 2009 14:03
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 29th Sep 2009 14:33
ok thanks, ill start reading it, that will take some time

Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 29th Sep 2009 15:01
Try not using dbRotateObject.
dbTurnObject, dbPitchObject, dbRollObject might work for you.
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 29th Sep 2009 15:24
Strange behavior..mind writing some code? because it's really confusing me, my camera somehow is getting way too far when i start rotating the model, here is my camera code:



Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 29th Sep 2009 15:38
It is quite confusing when you want free rotation on all three axis, I suggest you read darkcoders link for some detail on the problem, also be careful what commands you use as some are not compatable with free rotation.

Try avoiding dbRotate (camera or object), you may have more luck with dbSetCameraOrientation.
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 29th Sep 2009 15:51
The problem is that my main language is not english, and im still in high school, so i barely understand some lines in that link, well, i have a book which is written in my language, which includes like 200 page about 3d maths, i guess ill have to read them.

thanks.

Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 29th Sep 2009 16:04
Quote: "dbRotateObject
This command will rotate the specified 3D object around all three dimensions. The object number should be specified using an integer value. This method of rotation is called euler rotation and differs from free flight rotation. Euler angles retrieved from a free flight rotation specify a ZYX rotation, and you must call the dbSetObjectRotationZYX command on the Euler based object to make the two rotation systems compatible. "


Quote: "dbTurnObjectLeft
This command will rotate an existing 3D object to turn left. The rotation is independent of any axis orientation and allows free motion. The value of the angle can be positive or negative."



Try writing a small example without using dbRotateObject(), just use the turn, pitch and roll commands.
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 29th Sep 2009 16:19 Edited at: 29th Sep 2009 16:31
edit:nevermind thats my bad

the problem now with the camera ill try to fix it soon, but may you guys give me a little suggestion? in this game, A D for left/right, W to go forward, which buttons should be for going up/down? space = up and S = down?

Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 29th Sep 2009 16:24
Have you ever had your object rotating correctly, at its most basic level?

In your code at the top of the post you are using dbRotateObject, are you still using this command?

The camera and the object must both be using the same type of rotation (free).

Login to post a reply

Server time is: 2024-11-25 00:35:38
Your offset time is: 2024-11-25 00:35:38