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.

DarkBASIC Professional Discussion / Object rotation zyx broken?

Author
Message
Zeal
23
Years of Service
User Offline
Joined: 10th Oct 2002
Location: Colorado Springs, CO
Posted: 6th Sep 2003 06:16
I cant figure out if this command just isnt working or what. Im trying to zrotate a plain 45 degrees (like a diamond), then match the x and y angles with the camera, so the plain is always facing forward. However setting rotation to xyz or zyx, the plain never seems to rotate around the right axis, and ends up looking way off in the end.

Is this command busted? If not, can anyone show code to prove it works?

All you need is zeal
Ian T
23
Years of Service
User Offline
Joined: 12th Sep 2002
Location: Around
Posted: 6th Sep 2003 06:47
Why not Y rotate it too

--Mouse: Famous (Avatarless) Fighting Furball
Read It: http://www.angryflower.com/itsits.gif
Learn It: http://www.angryflower.com/bobsqu.gif
Zeal
23
Years of Service
User Offline
Joined: 10th Oct 2002
Location: Colorado Springs, CO
Posted: 6th Sep 2003 06:55
I am. rotate object a,45,90,45

The first z rotate rotates the plain along the z world axis 45 degrees, turning the plain like a diamond. Then the 90 degrees y rotate rotates the plain along the y world axis, turning the plain to the clockwise so that its facing left. However its the last x rotate that seems to screw things up. it seems to be rotating along the objects x axis, rather than the world axis... Can anyone else confirm or am I just nuts?

All you need is zeal
dark puppus
22
Years of Service
User Offline
Joined: 16th Aug 2003
Location:
Posted: 6th Sep 2003 10:41
YES. read my post "xwing driving". I use xrotate for rotating the object around its x axis. Is a bug yes, but i found the way to use it the same.

Finally, another found the problem. And no one in the forum said that there is a bug.

I can't show you now how rotate object around x space axis, but there's the way. I try to expalin in another post and you can try if it works. byez
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 6th Sep 2003 13:56
Lee has specifically said that there is not a bug ... several times, and I think that I agree.

Take one pen with a lid and hold it vertically point up in front of you with the clip towards you.
Now rotate it around the world x axis 45 degrees.
Now rotate it 90 degrees to the right around the y axis. You should now have the pen positioned like this '/' in front of you.
Now rotate the pen 45 degrees around the world z axis. You should now have the pen back in the vertical position with the clip to the left.

If you swap the z/x axis rotations in the instructions you will end up with the pen pointing away from you with the clip on the left.

What may work best for you is what I've put into the source box below
Zeal
23
Years of Service
User Offline
Joined: 10th Oct 2002
Location: Colorado Springs, CO
Posted: 6th Sep 2003 15:54
Wohooo fix object pivot is my friend. Ianm youre my friend too

Thanks!

All you need is zeal
dark puppus
22
Years of Service
User Offline
Joined: 16th Aug 2003
Location:
Posted: 6th Sep 2003 15:55
yes, the result is correct. But if you have the object rotated around y space axis, you'll see it moving along its x axis object if you use xrotate.

The bug exist, is too visible. y,z rotate works correctly. x do not!
Zeal
23
Years of Service
User Offline
Joined: 10th Oct 2002
Location: Colorado Springs, CO
Posted: 6th Sep 2003 16:14
Well im content with fix object pivot for now, it gets the job done. But you may be right, it sure seemed like xrotate wasnt working the way it should have been...

All you need is zeal
Fallout
23
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 7th Sep 2003 14:56
IanM ... I dunno what your typed theory is supposed to prove but I thought I'd put it into code just to see. In code, it did exactly as you said, which is fine. But as soon as you move it out on the y-axis as an example, surely if the rotations are working properly, it should arrive at the same result? Just offset a by the original value on the y-axis?

Well it doesn't. Check this out, and tell me if this is working as you'd expect. If it is, then I'll eat my own legs. (Run it first to see your way, then uncomment the yrotate bit at the top to offset it 45 degrees on the y)

Insiiiiiiiiiiiiiiiiiiiiiiiide!
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 7th Sep 2003 16:02
Simple. DBPro doesn't remember what rotations you have applied before and then apply the differences. Each time the object is rendered it is effectively reset to rotations 0/0/0 and the rotated again to the rotations you have specified.

I have added a bit of code to display the actual rotations taking place and also eliminated the effect of that initial x rotation (it will work its way back in later anyway) all in order to make it easier to see what is going on.

It's all working exactly as I'd expect
Fallout
23
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 8th Sep 2003 14:30 Edited at: 8th Sep 2003 14:33
Ian, I want to believe you that it works right. I'm playing around to see if I can figure out how to get the rotation to work properly, but I cant get past the barrier of the last axis rotating the object on the world axis.

Can you take the code I posted above, and plug in the values that'll do the rotation as it does normally when the yrotate line is uncommented? i.e. Set it up so it pitches forwards on the x, turns round on the y, and then tilts back up on the z-axis, as you described, but starting with a 45 degrees turn offset, and still returning to that vertical position. Surely it must be the same code I have in there but just different numbers to achieve that result?

Thanks a lot.

Insiiiiiiiiiiiiiiiiiiiiiiiide!
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 8th Sep 2003 15:47
I was working on a function-based solution last night, and got it working for camera rotation. I just have to convert it to work on objects too and I'll release it publicly.

You just specify an Elevation angle (equiv to x rotation), a Heading (around the now rotated y axis), and a Roll (around the fully rotated z axis).

The key is that the final z rotation keeps you pointing at the same point in space.

Oh, and there are no limbs or extra hidden objects used either
Fallout
23
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 8th Sep 2003 19:12 Edited at: 8th Sep 2003 19:13
Yeah. That's exactly it. Whenever I rotate on the z-axis, the object never continues pointing in the same direction in space and rolling. Instead, it points in a new direction. The only time it actually rolls around its own z-axis is when it's pointing down the worlds z-axis. As soon as I rotate it to any other heading and then use zrotation, the front of the object begins to point in new directions.

It just doesnt make sense to me. I'm not trying to be fussy either - I just can't do the sort of rotation I want. It just seems to me that pointing an object in any direction and then having a loop like:
do
zrotate object 1,wrapvalue(object angle z(1)+1)
sync
loop


Should make the object roll around its z-axis, keeping its heading, like you said. But it doesn't. So I just don't get it.

See the source button for another example.
-Hit a key to keep randomising a new direction
-The red box is the worlds z-axis
-The green box is the objects z-axis
Watch how, no matter what direction the object is pointing, it's always rotating nicely around the world z-axis, but never around its own axis.

Really need someone from the db team to say "hey ... you!!yeah you!! This is how it works!! Alright? Here's an example .... a good example."

Insiiiiiiiiiiiiiiiiiiiiiiiide!
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 9th Sep 2003 23:08
sorry, I have to let you down for now. The camera system I had was just too buggy, unpredictable, inaccurate and slow for real use. I am enjoying the frustration though, so I haven't totally given up yet

BTW, the quick fix for the source you have shown there is to change the ZROTATE line to 'ROLL OBJECT LEFT 1, 1'
Zeal
23
Years of Service
User Offline
Joined: 10th Oct 2002
Location: Colorado Springs, CO
Posted: 9th Sep 2003 23:24
So Zrotate IS broken? Why should we have to use roll object left? Im confused

All you need is zeal
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 10th Sep 2003 00:09
No, zrotate is *not* broken.

Once you are pointing in the correct direction, the roll commands will rotate your object around the local z axis.
Zeal
23
Years of Service
User Offline
Joined: 10th Oct 2002
Location: Colorado Springs, CO
Posted: 10th Sep 2003 00:35
But then youd have to use get object angle z().. that doesnt seem right. Seems to me like the rotate object command should have a local or world flag. That would solve all this crap wouldnt it?

All you need is zeal
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 10th Sep 2003 00:56
They are basically two sets of commands.

You have X/Y/Z ROTATE OBJECT to rotate around the world axis's, and you have the TURN/ROLL/PITCH commands to rotate around the object axis's - they don't mix too well though
Zeal
23
Years of Service
User Offline
Joined: 10th Oct 2002
Location: Colorado Springs, CO
Posted: 10th Sep 2003 01:02
Thats my point tho, they dont mix. Maybe turn/roll/pitch should be based on 360 values, rather than that left right crap. Either way seems it would be simpler to just use one command with a world/axis flag, but I guess this works.

All you need is zeal
Fallout
23
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 10th Sep 2003 05:21
The rotate xyz commands aren't based on the world axis though. Only some of the rotation order is. If you xrotate the object, it's local. Not sure about y. Havent tested it really. Z is world though. When switched to a zyx order, x is world and z is local. Very odd.

Insiiiiiiiiiiiiiiiiiiiiiiiide!
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 10th Sep 2003 15:55
*sigh* this is hard work.

The fact that you can reproduce the 'pen rotation' explanation with code proves that the rotations are all around the world axis's, but they are cumulative and in the sequence specified (ie xyz or zyx).
Fallout
23
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 11th Sep 2003 04:25
I have an IQ of 129, and I'm still clueless. But it is 1:25am.

Insiiiiiiiiiiiiiiiiiiiiiiiide!
Fallout
23
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 11th Sep 2003 14:23
Btw, Ian, you have to bare in mind that with the object at a yangle of 0 at the beginning, the objects x-axis and the worlds x-axis are parellel, so you're not proving its rotating around the world axis on the x-axis. It could well be rotating around the objects x-axis with the same effect.

Also, that pen rotation code should work exactly the same way if the object has an initial offset of an angle on the y-axis, but it doesn't. The pen rotation code only works when the objects x-axis is initially parellel with the worlds x-axis, otherwise it doesnt. If you ask me, that's proof the objects aren't rotating around the worlds x-axis at least.

This is frustrating for both of us, because you're convinced you're right. In fact, I think you'd probably go as far as to say you know you're right, and I feel exactly the same way.

Check out the source under the button. It shows three rotating boxes representing x,y and z axis. They all appear to be rotating correctly around the world axis objects. Then hit return. The first and last boxes (representing x and z axis) are offset 45 degrees on the y, and the middle box (representing y) is offset 45 degrees on the x-axis. The middle box and the last box continue to rotate around the world axis as you can see. However, the first box (x-axis) is rotating around its own local axis. This is clear to see with the new axis object created.

It's just not right, I'm sure of it.

Insiiiiiiiiiiiiiiiiiiiiiiiide!
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 11th Sep 2003 15:45
The angles are recalculated from 0/0/0 rotations each frame ... no more say
Bulleyes
23
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Cyberjaya, Malaysia
Posted: 11th Sep 2003 16:03 Edited at: 11th Sep 2003 16:30
Check out the last few post that I wrote in the thread,
http://developer.thegamecreators.com/?m=forum_view&t=15716&b=1

It is akin to the problem you stated, but this one is deal with XYZ rotation, which is the default rotation order.

I wonder whether there will be people that understand what I am explaining. I would appreciate if someone can comment on my explaination.

Thanks!

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

http://www.badnose.com/
Fallout
23
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 11th Sep 2003 20:48
Ian, I think I'm finally getting it. It would've helped if you'd made an attempt to explain it more clearly, but I think I'm understanding the process now, and seeing why the results are happening as they are. So when you tell db to rotate an object 45 degrees on the y, it doesn't do it there and then. Instead, it waits till the sync command, processes the xrotate value, then the yrotate value, and then the zrotate value.

Now I understand why it's doing what it's doing, and it makes total sense. Where's my feeling of relief though? It's not there, cos now I'm relegatted to using the free flight commands which don't return object angles. Arse.

Well, at least we cleared up that issue. Now I can start a new thread about the need for free flight commands to use the same formatting as the world rotate ones, as well as complaining about the lack of documentation again.

Insiiiiiiiiiiiiiiiiiiiiiiiide!
Bulleyes
23
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Cyberjaya, Malaysia
Posted: 11th Sep 2003 21:20
EXACTLY!! Finally I got someone that is able to understand the way rotation works in DBpro.

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: 11th Sep 2003 23:52
Well I'm confused ... my last post just repeat exactly what I said 4 days ago in this thread
Bulleyes
23
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Cyberjaya, Malaysia
Posted: 12th Sep 2003 06:02
Cheers, IanM. Give me a toss!

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

http://www.badnose.com/
Large Mouse
22
Years of Service
User Offline
Joined: 3rd Sep 2003
Location:
Posted: 12th Sep 2003 07:51
i'm confused. but, i'm tired. if i can't understand it tommorow, i'll ask for an explanation with short sentences and small words.
Fallout
23
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 12th Sep 2003 19:25
Well I'm confused ... my last post just repeat exactly what I said 4 days ago in this thread

It wasn't that. I read up on another post where someone was harking on about db not rotating until the sync command, and then it clicked.

Insiiiiiiiiiiiiiiiiiiiiiiiide!

Login to post a reply

Server time is: 2026-07-23 15:49:32
Your offset time is: 2026-07-23 15:49:32