Jump to content
  • Advertisement

Ludovic

Member
  • Content Count

    5
  • Joined

  • Last visited

Community Reputation

122 Neutral

About Ludovic

  • Rank
    Newbie
  1. Ludovic

    Camera Movement Issue

    Quote:Original post by Dunge As a general rule, if something compile it don't means that it work the way you intend it to do. That's called a bug. The tutorial seems great, my personal camera code is very similar. He could use "D3DXMatrixLookAtLH" instead of creating the matrix himself though. I don't have the time to look and debug your application, and I don't think anyone else will. Posting quick relevant section of the faulty code in the thread help for that. Since you don't know where is the problem in your code, you have to debug it. Set the application to be in a way that it don't behave properly, and then add a breakpoint in your camera class and check the values of members variables/final matrix to see if they are all set with correct values. Really? I didn’t know what a bug is. I mean I know how to program in c++, the DarkGDK and been using MSVS2005 and 8 but I never knew what a bug was till this moment. Thank you so much for telling me. Although that is not the actual issue. Now that is out of the way: no, the idea is that you can rotate and move forwards and backwards according to cameras axis, not the worlds axis. D3DXMatrixLookAtLH only allows you to move on the world axis due to pram 1 being a D3DXVECTOR3 of 'Camera Position' on the world axis. I didn’t mean debug it all. It compiles fine (as I said) but doesn’t behave the correct way. I posted the entire program so ppl could download and look at all the bits (hence the reference to where the view matrix was located, vis half way down the main.cpp file). Try reading an entire post and understanding the sentences before replying. Just a suggestion. ;) At any rate I've worked out that I was sending copies of the vectors and view matrix to the Render_Frame function rather than the address. Sending the address fixed it, although the orthogonal axis gets distorted by the floating point inaccuracies. I’m going to look into Quaternions if the 'Alternative Methods' bit as described in the tutorial doesn’t work.
  2. Heyheyhey, I’m trying to make a DirectX demo for my personal use but Ive got stuck on the camera. I’ve followed this tutorial: http://www.toymaker.info/Games/html/camera.html and, although the result rotates (yay), the camera won’t move left, right, up, down or forwards/backwards on its own axis, only the worlds axis. For example, if you rotate 45 degrees to the right and then hit up->forward then you go diagonally forward along the Z axis rather than forward along the x and z axis together (forward movement). The thing is that the source code for the above tutorial works the way I want it to (obviously cus it compiles) but I cant make a working replica of the code in my demo nor copy the bits of the code I want and leave the rest due to the above paragraphs effects. To me the code I have looks like it should work so...I don’t know anymore, any got a clue? =) Link to files: http://siolis.squarespace.com/download/ (Note: The view matrix is processed about 1/2 of the way down the page) It compiles fine and various things happen (the cube translates and rotates, the lights come on and off if you hit O or F etc) if you press 1-9 and hit one of the arrow keys on a querty keyboard. Key 8 and the arrow keys move the cam and key 9 and the arrow keys rotate it. Oh and I’m working in MSVS2008 Express so you will need that to compile. No secrets, copy anything ya like.
  3. Ludovic

    Moving my character...

    Funny thing, i just worked out how to do it before I checked here. if ( dbMouseClick ( ) == 1 ) { if ( Once == 1 ) { if ( dbObjectPositionX ( 2 ) < dbObjectPositionX ( 1 ) ) { One = dbObjectPositionX ( 1 ) - dbObjectPositionX ( 2 ) ; } // 100 if ( dbObjectPositionY ( 2 ) < dbObjectPositionY ( 1 ) ) { Two = dbObjectPositionY ( 1 ) - dbObjectPositionY ( 2 ) ; } // 50 Three = ( One / 10 ) ; // X Moves - 10 Four = ( Two / 10 ) ; // Y Moves - 5 if ( Three > Four ) { Five = Three / Four ; } // - 10 / 5 = 2 if ( Three < Four ) { Five = Four / Three ; } // if ( Three > Four ) { Six = 10 / Five ; } else { Six = 10 ; } // if ( Three < Four ) { Seven = 10 / Five ; } else { Seven = 10 ; } // 10 Once = 0 ; } if ( dbObjectPositionX ( 2 ) < dbObjectPositionX ( 1 ) ) { dbPositionObject ( 1, dbObjectPositionX ( 1 )-Seven, dbObjectPositionY ( 1 ), dbObjectPositionZ ( 1 ) ) ; } //if ( dbObjectPositionX ( 2 ) > dbObjectPositionX ( 1 ) ) { dbPositionObject ( 1, dbObjectPositionX ( 1 )+10, dbObjectPositionY ( 1 ), dbObjectPositionZ ( 1 ) ) ; } if ( dbObjectPositionY ( 2 ) < dbObjectPositionY ( 1 ) ) { dbPositionObject ( 1, dbObjectPositionX ( 1 ), dbObjectPositionY ( 1 )-Six, dbObjectPositionZ ( 1 ) ) ; } //if ( dbObjectPositionY ( 2 ) > dbObjectPositionY ( 1 ) ) { dbPositionObject ( 1, dbObjectPositionX ( 1 ), dbObjectPositionY ( 1 )+10, dbObjectPositionZ ( 1 ) ) ; } } Thanks anyway. ^_^
  4. Greetings all, I am trying to build a game engine but I can't seem to work out how to move my character around the way I want. What I'm after is the character moving to where I have clicked my mouse so if the char is at 0, 0 (it's a 2D game btw) and I click on 10, 10 then the character moves to 10, 10 at a pre-determined speed, like 10. The trouble is that if I click on 200, 100 then it moves diagonally up until it comes to 100, 100 and then moves along until it hits 200, 100. This obviously isn’t any good. I realize that the off-diagonal means that it travels along faster than up but I can't seem to set my C++ code to do so and retain the 10 movement speed. I’ve tried moving it along at 10 and slowing down the up movement by finding how many up must occur to every along (i.e. 2 along to every 1 up) but my code just doesn’t seem to work. Anyone got any ideas by any chance? Cheers. /Ludo
  • 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!