Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Sam Gamgee

Please help me

This topic is 6449 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi everyone, I went through just about all of NeHe''s tutorials for GL and wanted to say they are the best tutorials I''ve ever read about OpenGL! However now I''m working with DirectX 8. I tried to implement one of NeHe''s tutorial (the one where you can walk around the world), but for some reason the results aren''t the same. Maybe someone here can help me. I''m trying to get the code below to work: Level1.Level.MeshPos.x -= (float)sin (Level1.Level.MeshAngle.y*piover180)*0.005f; Level1.Level.MeshPos.z -= (float)cos(Level1.Level.MeshAngle.y*piover180)*0.005f; The above code gets called whenever the user hits the UP arrow key, however it doesn''t work like it did in OpenGL. I''m probably missing something simple, but maybe you could point it out to me? Thank you very much for any help anyone can give me, -Sam. p.s. The above code is the same as it is in the tutorial (I think it''s tutorial 10, but I''m not sure)

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
In OpenGL is the Z-axis pointing out of screen D3D default is the other way around. I think that you can set the coordinate system in D3D so it will be like OpenGL.

Share this post


Link to post
Share on other sites
Hi,

Thanks for your reply! However I don''t think I know what you mean. Acording to my experiments in DX8 all the axis seem the same.

-Sam.

p.s. I forgot to mention that I also tried the following:

Level1.Level.MeshPos.x -= (float)sin(Level1.Level.MeshAngle.y)*0.005f;
Level1.Level.MeshPos.z -= (float)cos(Level1.Level.MeshAngle.y)*0.005f;

Only difference is no piover180, but it still doesn''t work Thanks for any help anyone can give.

Share this post


Link to post
Share on other sites
Arrgh! I can sympathise on this one.

unfortunately, all I can say is keep plugging at it...

I''ve done this three times now.

I write the code, as I think it should work.
It doesn''t.
I fiddle with it for hours.
It still doesn''t work.
I change it back to what I thought I started with and it works...

very annoying, and probably says a lot about my coding skills!

good luck though!




I used to be indecisive. Now I''m not so sure...

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Arrgh! I can sympathise on this one.

unfortunately, all I can say is keep plugging at it...

I''ve done this three times now.

I write the code, as I think it should work.
It doesn''t.
I fiddle with it for hours.
It still doesn''t work.
I change it back to what I thought I started with and it works...

very annoying, and probably says a lot about my coding skills!

good luck though!




I used to be indecisive. Now I''m not so sure...

Share this post


Link to post
Share on other sites
What are the symptoms ? I mean, you say it doesn''t work like it''s supposed to do, but in what way is it diffrent ?

(eg, you walk backwards instead of forward? or you fly up in the air? perhaps pink elephants spawn and do the kalinka?.. now that would be really weird.. )



return 1;

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
To be honest I can''t really tell whats going on, but I''ll try to describe it. When the level first loads, and everything is setup at angle 0 and position 0, everything works fine. Because whenever I press the up arrow key, the camera moves forward like it''s supposed to. However when I rotate just a little bit & then press the up arrow key, the camera still moves in the same direction as it did before when I didn''t rotate!

However if I rotate a lot (>20 degrees), then the camera moves in yet another direction...but not where I want it to go! It''s very wierd!

I can''t find a pattern to whats going on...it''s really confusing!

(BTW: actually the elephants are blue )

Thanks for any help.

-Sam.

Share this post


Link to post
Share on other sites
I think there''s a DirectX version of NeHe''s tutorials called NeXe. I don''t know where it is, but I''m sure there''s a link around here somewhere.

Share this post


Link to post
Share on other sites
When the anonymous poster said the z-axis was reversed, what he meant was this:

The x-axis increases as it goes right. That means an object at x-coordinate 2 is to the right of an object at x-coordinate 1.

The y-axis increases as it goes up. So an object at y-coordinate 2 is above an object at y-coordinate 1.

But which direction does the z-axis go? Well, it can go either way (farther or closer). One way is called "right-handed", the other is "left-handed." OpenGL is right-handed, and Direct3D is left-handed by default, though you can make it right-handed. If you''re using the D3DX functions, D3DXLookAtLH is left-handed, D3DXLookAtRH is right-handed. There are LH and RH versions of the other view-related matrix operations as well.

But I don''t even think that''s the cause of your problem. It sounds like the problem is with setting your transformation matrix. How do you calculate it?

~CGameProgrammer( );

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!