Skip to main content
GameDev.net gamedev.net
🔒 Locked

X Direction?

Started by FlorianapoliS Jul 18, 2002 at 1:30 AM 13 replies 900+ views
Original Post
FlorianapoliS
FlorianapoliS
When my car is moving right OpenGL says it moving in the negative X Direction? I thought this way was always positive?
Thunder_Hawk
Thunder_Hawk
This would be true if you rotate the y axis by 180o.

Hope that helps a bit.

_____________________________

And the Phoenix shall rise from the ashes...

--Thunder_Hawk -- ¦þ
______________________________
______________________________________________________________________________________The Phoenix shall arise from the ashes... ThunderHawk -- ¦þ"So. Any n00bs need some pointers? I have a std::vector<n00b*> right here..." - ZahlmanMySite | Forum FAQ | File Forma
FlorianapoliS
FlorianapoliS
quote:
Original post by Thunder_Hawk
This would be true if you rotate the y axis by 180o.

Hope that helps a bit.

_____________________________

And the Phoenix shall rise from the ashes...

--Thunder_Hawk -- ¦þ
______________________________


Don''t think I''m rotating it 180o, but if I did rotate it 180o would it correct everything?

sark
sark
It sounds although you''ve forgotten that the Z axis goes negative into the screen, and planned all your geometry assuming a positive Z axis... which is effectively rotating your Y axis by 180 degrees.

Wow, i hope that made sense. This may be better explained with a diagram, except i cant draw.
FlorianapoliS
FlorianapoliS
So what would be a good means of correcting this? I was also just wondering if positive rotation on the Z axis is clockwise, or anticlockwise?
Khaydarian
Khaydarian
Ok, I''m detecting a lot of confusion in here. The way I see it, there are two distinct (and mutally exclusive) possibilities here:

1) You''ve somehow rotated the scene 180 degrees, or you''re looking at it from the other direction (-z instead of positive). This was suggested by Thunder_Hawk above.

2) You''ve got you''re model saved wrong: it assumes a left handed coordinate system (like Direct3D) instead of a right handed coordinate system (like OpenGL), or vice versa. This was suggested by sark.

If it was 1), odds are your car went backward the first time you tried it, and you added a negative somewhere to fix it. If it was 2), you probably got a car model from somewhere that was saving them with the opposite axes. Or, it could be a problem with the way you''ve set up the projection or modelview matricies. Or, something else entierly. Or, cosmic rays refelcting off the atmosphere of Venus and flipping a bit in you''re RAM. Without more information, I really can''t tell you.

Of course, my money''s on the cosmic rays.

--Khaydarian
Thunder_Hawk
Thunder_Hawk
quote:
Original post by Khaydarian
Or, something else entierly. Or, cosmic rays refelcting off the atmosphere of Venus and flipping a bit in you''re RAM. Without more information, I really can''t tell you.

Of course, my money''s on the cosmic rays.

--Khaydarian


Yes, the answer to all 2-day bugs.

_____________________________

And the Phoenix shall rise from the ashes...

--Thunder_Hawk -- ¦þ
______________________________
______________________________________________________________________________________The Phoenix shall arise from the ashes... ThunderHawk -- ¦þ"So. Any n00bs need some pointers? I have a std::vector<n00b*> right here..." - ZahlmanMySite | Forum FAQ | File Forma
FlorianapoliS
FlorianapoliS
quote:
Original post by Khaydarian
Ok, I''m detecting a lot of confusion in here. The way I see it, there are two distinct (and mutally exclusive) possibilities here:

1) You''ve somehow rotated the scene 180 degrees, or you''re looking at it from the other direction (-z instead of positive). This was suggested by Thunder_Hawk above.

2) You''ve got you''re model saved wrong: it assumes a left handed coordinate system (like Direct3D) instead of a right handed coordinate system (like OpenGL), or vice versa. This was suggested by sark.

If it was 1), odds are your car went backward the first time you tried it, and you added a negative somewhere to fix it. If it was 2), you probably got a car model from somewhere that was saving them with the opposite axes. Or, it could be a problem with the way you''ve set up the projection or modelview matricies. Or, something else entierly. Or, cosmic rays refelcting off the atmosphere of Venus and flipping a bit in you''re RAM. Without more information, I really can''t tell you.

Of course, my money''s on the cosmic rays.

--Khaydarian


Yeah I too was exploring the effects of cosimc rays from Venus with little result.

My game is a GTA style car game (overhead racer). I translate -20.0f on the Z axis before I draw anything so that I can actually see the amount of the map I want. I don''t use a car model yet, its only a textured quad so I don''t think that would be effecting it? I only rotate the car on the Z axis by which way the car is facing, but when I rotate the car by 90 degrees it faces left? Everything is reversed almost? If you need to see any code just ask for what you need and I shall post

Deyja
Deyja
Roating 90 degrees should point it left, assuming it started facing forward (top of screen). Positive is COUNTERclockwise when looking down the z-axis from negative to positive. If you want 90 to mean right, just, rotate by -yourdegrees.

edit - I said clockwise. X.x

[edited by - Deyja on July 19, 2002 11:57:17 PM]
FlorianapoliS
FlorianapoliS
But I''m translating -20.0f into the screen before I draw, wouldn''t that mean I''m looking positive to negative?
Deyja
Deyja
Translating will never change the direction you are looking in. And, coincidentally, you are translating -20.0f out of the screen.
FlorianapoliS
FlorianapoliS
I know its all relative I''m just trying to work out how to make it relative so that +ve x is right?
Deyja
Deyja
You would have to translate +20.0f into the screen, rotate 180 degrees on the y axis, and switch the sign of all the z''s in your rendering code.

Actually, 90 degrees should point UP, and zero should be to the right. You''ll likely save yourself some headache later if you go with this ''standard'' system.
FlorianapoliS
FlorianapoliS
Yeah, I think I''ll just throw some negatives in Thanks for all your help

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.