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.

Author
Message
dark puppus
22
Years of Service
User Offline
Joined: 16th Aug 2003
Location:
Posted: 26th Aug 2003 13:01
I'm programming a game like rogue squadron, and i'm implementing the rotations of the fighter and the camera.

Problem 1:
When i rotate left the wing, i wish to rotate even the fighter around his z axis giving the sense of movement. But the z rotation seems to be not around z axis of the fighter. The other rotations are influenced by this. Im going to get you the source code when if you press the leftkey z angle are modified and if you press rightkey y angle are modified. After 2 or 3 rotations you'll see the y and z rotation to become strange.

See the source code (i've modified it for show you the problem)

Problem 2:
It's a mathematical problem to determine the position of the camera behind the fighter when it moves or rotate up,down and left right.
dark puppus
22
Years of Service
User Offline
Joined: 16th Aug 2003
Location:
Posted: 26th Aug 2003 13:04
i forget the source code: voila' ...
Philip 1337
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 26th Aug 2003 13:27 Edited at: 26th Aug 2003 13:28
Problem 2
You could try using:



I hope this helps
dark puppus
22
Years of Service
User Offline
Joined: 16th Aug 2003
Location:
Posted: 26th Aug 2003 16:58
I report this on the bug forum maybe ?

In the game x rotation is around the object, y around the space, z around what(????).

Anyone know how get out of this ? See the source in the second post.
spooky
23
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 26th Aug 2003 17:14
To make an object rotate around the object's own z axis, you would be best using ROLL OBJECT LEFT and ROLL OBJECT RIGHT

The programmer formerly known as sonic
Bulleyes
23
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Cyberjaya, Malaysia
Posted: 26th Aug 2003 17:38
Erm... this isn't a bug actually. I had been puzzling with this rotation thing since I started to use DBpro for my space sim game. Luckily I managed to sort this out after reading some DirectX docs and also some math book.

Those rotation commands like Rotate Object or X rotate object, etc. are actually not rotating the objects around the object's own axis, but instead rotate respect to the world axis. The default order of rotation is XYZ, meaning that the object will rotate the X angle first, follow by Y angle, and finally Z angle. If you understand matrix math, these commands are use to built up the object rotation matrices. And the rotation matrices concatenation order determines the final orientation of the object.

To help you better visualize this process, assumed that your ship has the current rotation of 90, 0, 0 respect to X, Y, Z rotation angle. Thus, your ship nose is now pointing at west side. Now, if you call Z rotate object 90, you will see your ship noss now is pointing DOWN! I know this is not what you expected, but it is happening because the rotate command is respect to the world axis.

That's the reason free flight command come into rescue. Those Roll object, pitch and turn object are free flight commands. These commands rotate object on its own axis, which I think is what you had been looking for.

Hoped this helps!

Bad Nose Entertainment - Where games are forged from the flames of talent and passion.

http://www.badnose.com/
dark puppus
22
Years of Service
User Offline
Joined: 16th Aug 2003
Location:
Posted: 26th Aug 2003 18:13 Edited at: 26th Aug 2003 18:37
i hope you're right.

But the X rotation is around the ship. Try if you have time my source. You'll see the y rotation are ever around the Yaxis of space, but not the x rot.. Again the z rotation is around the world.

In the early example you gave me, the rotation 90,0,0 is a x rotation and the ship face south.
If with 0,0,0 i set rotation 0,90,0 my ship turn left(or right), and with another 90,0,0 my ship point down. I want to say that the ship does'nt turn around the x axis of the space, but around his axis.

Sorry for the confusion, but i tested this for weeks, and an elegant solution never found.
Bulleyes
23
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Cyberjaya, Malaysia
Posted: 26th Aug 2003 20:36
Yup, it is what I expected, the ship will face down. Ok, let me explain it clearer. Remember that I told you about the rotation order is XYZ, maybe I miss a little detail, but what I meant is, no matter how you rotate it, your object doesn't get rotated until the SYNC command is called. When this is called, DBpro concatenate all the rotation you issue in the order of XYZ.

So for your example, you rotate 90 degrees at Y axis, follow by 90 degrees against the X axis. If you understand matrix math, the final rotation matrix for the object will be

matrixRot = matrixRotX * matrixRotY * matrixRotZ

In a simpler term, all the rotation commands you issued, despite the order you call Rotate Object Y prior Rotate Object X, the final rotation will be concatenate as (90, 90, 0). So by following the XYZ default rotation order of DBpro,

1. Rotate 90 degrees at X axis, your ship nose now facing south, with its wing spanning to west and east.

2. Rotate 90 degrees at Y axis, your ship nose is still pointing down (since it is parallel to Y axis after step #1), but now its wing spanning to north and south.

Is my descriptions depict what is shown on your screen?
Please excuse me if my descriptions was a little bit confusing, I need to catch some sleep now.

Bad Nose Entertainment - Where games are forged from the flames of talent and passion.

http://www.badnose.com/
Bulleyes
23
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Cyberjaya, Malaysia
Posted: 26th Aug 2003 20:52
Hmmm... to clear up my explaination, you notice that



and the following,



produce the same result. Conversely, if you are using free flight, you will get what you expected. For instance,



will produce different result as



Hoped this clears things up a little bit.

Bad Nose Entertainment - Where games are forged from the flames of talent and passion.

http://www.badnose.com/
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 26th Aug 2003 21:11
There is an excellent piece of code here for rotations : http://developer.thegamecreators.com/?m=forum_view&t=14619&b=1

Basically, choose the rotation system you are after, then rip out the code.
Scorpyo
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: italy
Posted: 27th Aug 2003 01:06
Or go here, read my post and download and try the attached zip

cheers

http://www.realgametools.net/forums/index.php?board=18;action=display;threadid=15437;start=20
dark puppus
22
Years of Service
User Offline
Joined: 16th Aug 2003
Location:
Posted: 27th Aug 2003 11:57
BullEyes wrote :
Quote: "Is my descriptions depict what is shown on your screen?
Please excuse me if my descriptions was a little bit confusing, I need to catch some sleep now.
"


Yes, but if i x rotate again it execute a rotation around the axis of the object, not about the x axis world.

Ex:
1) 90,0,0 --> face down (wings west and east)(rot. around x axis world) OK
2 0,90,0 --> face down (wings south and north)(rot on y axis world) OK
3 90,0,0 --> face east (wings south and north)(rot on z axis world or rotation on x axis of the object ???????).

I exclude the z rotation on point 3 because i can see this with any angle of the y rotation. The ship rotate ever around x object axis.

Try my example, you can see this.
Bulleyes
23
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Cyberjaya, Malaysia
Posted: 28th Aug 2003 09:01
ok, if I got you right, you make this rotation first,

1) 90,0,0
2) 0,90,0

which will makes the object rotation matrix of (90, 90 0), which makes the ship face down wings spanning from south to north.

Then at some point in time, you rotate,

3) 90,0,0

thus update the object rotation matrix to (180, 90, 0). Thus make the ship face outwards the screen, wing spanning from east to west, but the ship is inverted.

Get a better picture now?

Bad Nose Entertainment - Where games are forged from the flames of talent and passion.

http://www.badnose.com/
Bulleyes
23
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Cyberjaya, Malaysia
Posted: 28th Aug 2003 09:05
Ooops... correction, the final output is you will see

The ship face east, wing spanning from north to south, but the ship is inverted, i.e. landing gear facing up.

Bad Nose Entertainment - Where games are forged from the flames of talent and passion.

http://www.badnose.com/
Bulleyes
23
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Cyberjaya, Malaysia
Posted: 28th Aug 2003 09:17
I also assumed that during the third rotate, you are adding the previous X angle such as,

ax# = object angle x(1)
x rotate object 1, ax#+90

Correct me if I am wrong. Or better still, post some source code here.

Bad Nose Entertainment - Where games are forged from the flames of talent and passion.

http://www.badnose.com/
dark puppus
22
Years of Service
User Offline
Joined: 16th Aug 2003
Location:
Posted: 28th Aug 2003 14:00
Quote: "
ax# = object angle x(1)
x rotate object 1, ax#+90
"


No, i did'nt, it's xrotate object,degree

i never used incremental degrees

After many hours i make this theory (i should never have to do that):

1 : x rotate is around the object, y around the y axis of the world

or

2 : x,y rotate are around the screen (y is up anytime, x is right anytime, maybe even z is forward anytime).

with screen i mean the view of the camera.

It can't be like you say, first for the x rotation.

For the roll,pitch and turn rotation i can't use it because these are too complicated and all the angles are modified.

I show you the alfa.alfa version of my xwing game for now.
You will see that the rotation x,y are like i say.

Hope you understand and help me.
dark puppus
22
Years of Service
User Offline
Joined: 16th Aug 2003
Location:
Posted: 28th Aug 2003 14:02
I forgot the code source


You can view the movement of the ship at controlCommands sub.

hi
spooky
23
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 29th Aug 2003 03:51
If you are still struggling, look at my post about floating cameras and spaceships as I think I have now mastered the free-flight commands together with floating cameras.

The programmer formerly known as sonic
Bulleyes
23
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Cyberjaya, Malaysia
Posted: 29th Aug 2003 07:56
Where can I find your post? Can you provide me the link to it?

Bad Nose Entertainment - Where games are forged from the flames of talent and passion.

http://www.badnose.com/
dark puppus
22
Years of Service
User Offline
Joined: 16th Aug 2003
Location:
Posted: 29th Aug 2003 13:12
ok ! i solved the puzzle

x rotate is bugged ! my ship turn around its x axis (or screen axis)

y,z rotates around y,z space axis

Right ?

The wrong is that the help is not too clear.
I hope the newer versions to be more precise and structure.
dark puppus
22
Years of Service
User Offline
Joined: 16th Aug 2003
Location:
Posted: 29th Aug 2003 14:44
I'm near the solution for my game.

If it work, my future work is to perfectioning the game and
public it.

you find the spooky example in one post in a topic that you can find
if you search with "floating camera"
dark puppus
22
Years of Service
User Offline
Joined: 16th Aug 2003
Location:
Posted: 30th Aug 2003 03:46
and how i can reposition my ship horizontally on the screnn (i.e. parallel to xz plain ?) when i release the arrow keys ?

This is more difficult because the roll,pitch and turn rotation affects all angles.

I never thought that this was so difficult...
Have you any idea ?
dark puppus
22
Years of Service
User Offline
Joined: 16th Aug 2003
Location:
Posted: 2nd Sep 2003 02:04
hope this long silence confirm the bugs with rotations.

SIGH ...
Philip
23
Years of Service
User Offline
Joined: 15th Jun 2003
Location: United Kingdom
Posted: 2nd Sep 2003 11:37
There are no bugs with rotations. The only bug is the difficulty of our 2D brain understanding 3D rotation!

Phil

What do you mean, bears aren't supposed to wear hats and a tie?
dark puppus
22
Years of Service
User Offline
Joined: 16th Aug 2003
Location:
Posted: 2nd Sep 2003 12:14
ehm, have you seen the xrotate ? it never rotate around x axis space, but around the object. Not like y and z rotate. This is a fact.

Yes, i accept my limitations to think in 3d, but a single 3d rotation around an axis is too simple to make misunderstanding.

Maybe i have to understand more on the sync command for this?
Bulleyes
23
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Cyberjaya, Malaysia
Posted: 3rd Sep 2003 11:28
I had been occupied with some other things lately. Let me try out your experiment and get back to you by this weekend.

Bad Nose Entertainment - Where games are forged from the flames of talent and passion.

http://www.badnose.com/
Ermes
23
Years of Service
User Offline
Joined: 27th May 2003
Location: ITALIA
Posted: 4th Sep 2003 18:25
ciao, ti leggo un po' confuso sulle rotazioni, e vedo che chi ti ha risposto ne capisce ancora meno, spiegami in italiano per bene il problema e vediamo se insieme lo risolviamo.

Free Download for a Free World
dark puppus
22
Years of Service
User Offline
Joined: 16th Aug 2003
Location:
Posted: 5th Sep 2003 02:06
uhn ? come fai a sapere che sono italiano ?

cmq credo quasi di aver risolto il problema, nonostante il fatto che il bug secondo me rimane, quindi l'ho scavalcato.

Prova a fare effettuare ad un cubo delle rotazioni con xrotate,yrotate e zrotate. A parte xrotate, tutte le altre sono riferite agli assi spaziali.
xrotate e' invece riferita all'oggetto. Almeno così e' nel giochino che sto preparando.

I can't post only in italian, you understand, is'nt right for the community. Maybe for a problem lexically hard to explain ...

Piace anche a me vedere che non sono l'unico in questo covo di gente, la cui maggioranza si alza dal letto alle 3 del pomeriggio, come italiano. Ne conosci altri ?
Bulleyes
23
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Cyberjaya, Malaysia
Posted: 5th Sep 2003 10:16
Che cosa siete tipi che parlano?

Bad Nose Entertainment - Where games are forged from the flames of talent and passion.

http://www.badnose.com/
Ermes
23
Years of Service
User Offline
Joined: 27th May 2003
Location: ITALIA
Posted: 5th Sep 2003 10:58
e' vero, le rotazioni col vololibero funzionavano bene solo sul vecchio darkbasic classic.
comunque ti vedo ben ferrato in materia, ti posso dare un consiglio , usa oggetti fantasma applicati all'oggetto da controllare (glue object to limb) per rilevarne i dati, eventualmente per la telecamera, crea un limb di dove vorresti la tua telecamera, nascondi il limb, poi rilevane la posizione, a quel punto posiziona la telecamera sulle coordinate del limb e puntala verso il cento dell'oggetto.
A me funziona sempre. In bocca al lupo per il tuo programma.

Free Download for a Free World
dark puppus
22
Years of Service
User Offline
Joined: 16th Aug 2003
Location:
Posted: 7th Sep 2003 04:34
i solved the thing in a different way, but i hope that the new patches don't push me to recode the program.
Bulleyes
23
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Cyberjaya, Malaysia
Posted: 7th Sep 2003 12:25
Hi, I am back. Sorry for the long waiting.

I had tried several different ways rotating the object to try out the conclusion that you come out with. Unfortunately, I still don't quite get it how you come out with that conclusion. No matter how I rotate it, I still manage to explain it using the way I described above. The code I use for testing is as below,



Do you mind post a simple code to justify your conclusion, preferabbly as short and concise as possible, don't paste your game code (it's kinda cluttering in that way). Try to explain what you expect to see, and how you justify the phenomena using your own justification. (Man, I hoped you don't think that I am a mad scientist.)

Thanks!

Bad Nose Entertainment - Where games are forged from the flames of talent and passion.

http://www.badnose.com/
Ermes
23
Years of Service
User Offline
Joined: 27th May 2003
Location: ITALIA
Posted: 8th Sep 2003 10:32
ok darkpuppus, good luck anyway.

Free Download for a Free World
dark puppus
22
Years of Service
User Offline
Joined: 16th Aug 2003
Location:
Posted: 8th Sep 2003 22:44
This code should show you that if you rotate the object with yrotate (y space axis) a following rotation with xrotate rotate the object around the x axis of the object itself, not around the x space.

Maybe this appens to an object .x but not with an object made with db.
Bulleyes
23
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Cyberjaya, Malaysia
Posted: 9th Sep 2003 14:30
I see what you mean... It is not a bug. Ok, let me explain it again. Here goes....


Remember I told you about the rotation order is X -> Y - > Z? You get the conclusion of

"if you rotate the object with yrotate (y space axis) a following rotation with xrotate rotate the object around the x axis of the object itself, not around the x space."

is totally consistent with my explaination of rotation. Why is this happening? Let us concern with only X and Y rotation, shall we?

1. You need to keep in mind that no matter what is the current orientation of an object, or how far you had rotate it, DBpro will just keep the value of the XYZ rotation without actually applying the rotation on the object until SYNC command is called.

1. When the SYNC command is called, the object rotation will ALWAYS start at (0, 0, 0). And then DBpro will create the rotation matrix based on the rotation values associated with the respective object.

2. Since the rotation angle starts at (0, 0, 0), the object's local axes will be simillar (or parallel) to the world axes. (You can change this, thru using PIVOT OBJECT or when you model it, though I doubt you did in this case.)

3. Remember that X rotation will always get executed first, even if you issue Y ROTATE OBJECT first.

4. Due to this, no matter how you rotate Y axis, it seems as though as the X rotation is always rotating around the object local X axis. (Recall that X get rotated first, and before the rotation is applied, object's local X axis is parallel to the world X axis.)


Hmmm... I think it is as clear as mud.
Perhaps an example will help, again, let just concern ourself with X and Y rotation is enough.

1. Let's say I Yrotate the object at the angle 45. As expected, the ship is now turning right for 45 degrees.

2. In my main loop, I also put a IF statement to check whether the user press certain key, if it is pressed, I Xrotate the object at angle 45.

3. If the user didn't press anything, the ship will always pointing 45 degrees to the right.

4. As soon as the user hit the key, voila, the ship is now pointing 45 degrees to the right, will tilting up the nose by 45 degrees! It seems like the Xrotate is rotating around the ship's local X axis.


EXPLAINATION:
- During step #1, DBpro recorded the ship's rotation state as (0, 45, 0).

- Thus everytime SYNC is called, the ship will initially at its original state at rotation (0, 0, 0). Then it creates the rotation matrix based on the current rotation state. The rotation matrix will based on XYZ rotation order. You can think this more like, everytime when SYNC is called, each object will initially at its original rotation state, then DBpro apply the X rotation -> Y rotation -> Z rotation.

- During step #4, as soon as the user hit a key, DBpro update the ship's rotation state as (45, 45, 0)

- Now, if you understand what I am talking about until now, you will shoud out loud "BINGO!". As you can see here, the object will now rotate at X angle 45 degrees from the original state, thus tilting the nose up. Then follow by turning to the right 45 degrees.

- The reason why you think X rotate is on its local axis is because X angle always get rotated first, and at the object original state, the object's local axes is parallel to the world axes.

Phew... I don't even know what I am talking about. I doubt you will. I wonder why I am writing this. Hmmm....

Bad Nose Entertainment - Where games are forged from the flames of talent and passion.

http://www.badnose.com/
Bulleyes
23
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Cyberjaya, Malaysia
Posted: 9th Sep 2003 14:33
Try change the rotation order by calling SET OBJECT ROTATION ZYX.
You will now notice that Zrotate always rotate on its local Z axis. Why? The explaination is the same, by just changing the rotation order.

Bad Nose Entertainment - Where games are forged from the flames of talent and passion.

http://www.badnose.com/
dark puppus
22
Years of Service
User Offline
Joined: 16th Aug 2003
Location:
Posted: 12th Sep 2003 03:02
well, i understand this, but this is no easy to manipulate.

If i have a command that allow me to rotate object around an axis space i have to expect it rotates like i think.

With this solution can i find the way to x rotate object around the space or see the difference between xrotate and pitch object ?

For now i solved the problem using fix object pivot. My ship fly very fine now.

Sorry but the university take me all the time and my work proceed very slowly.
Bulleyes
23
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Cyberjaya, Malaysia
Posted: 12th Sep 2003 05:51
Hmmm... I don't really understand how to do you use FIX OBJECT PIVOT to workaround with this. Mind show me some snippets?

Thanks!

Bad Nose Entertainment - Where games are forged from the flames of talent and passion.

http://www.badnose.com/
BatVink
Moderator
23
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 13th Sep 2003 01:17
Does this simplify the issue...

If you rotate the object around ANY 2 axes it will look "normal". In 2 dimensions, one axis will have no impact on the other. But as soon as you do 3 at any one time, the first 2 impact on the third.

dark puppus
22
Years of Service
User Offline
Joined: 16th Aug 2003
Location:
Posted: 18th Sep 2003 13:30
Sorry for waiting...

I can't actually post snippet code, i upgraded the system, and i have to reinstall DBP.

Really the fix object pivot is used to give to the ship a sens of mouvement right or left, nothing special.

I post the game trial in the release after few adjustement. For now it looks poor, with a only 1 level on water (fixed...sigh, i don't have the time for this problem).

When i release the game i advice you. I post even the code for trial. I'm for the free source.

Login to post a reply

Server time is: 2026-07-26 05:02:41
Your offset time is: 2026-07-26 05:02:41