Moving an object

Started by
3 comments, last by Madi 16 years, 4 months ago
Hi everyone. This is my first post on the forums, so I don't know if this is the correct place to post this topic. First off, I've got to mention that I'm coding in C++ using Visual Studio 2005. Of course, the API is DirectX (June 2007). --Now, the problem which has been bothering me a bit, is that I can't get an object moving properly when two actions are done at once. For instance, the player is able to move the object front, back, turn left and right, BUT - whenever we choose to turn the object, say left, while it is going forward, the object turns to the right. Other than that, the movement seems to be ok. Any help or guidance would be great. If there is any more information you would like to know in order to provide a more precise solution, then don't be afraid to ask, 'cause as said, this is my first post here in the forums. Thanks in advance. Happy coding.
Advertisement
Could you post your code? That would be helpful, however I would guess that your problem has something to do with your matrix multiplication or construction.
I am at Uni now, but when I get back tonight I will post my code.
Well, it won't hurt if I posted some info..

What I've been using to create my 3D scene is the "Direct3D Third Person Camera Demo" which can be found on http://www.dhpoware.com/demos/d3dThirdPersonCamera1.html


I have made alot of changes in it, especially in the main.cpp file. When I added another object instead of the 10-ball you could see the face of the object (the player) instead of its back. So i simply changed this line of code (line 445 in main.cpp):

g_camera.lookAt(D3DXVECTOR3(0.0f, g_ballRadius * 3.0f, -g_ballRadius * 7.0f)

into:

g_camera.lookAt(D3DXVECTOR3(0.0f, g_ballRadius * 3.0f, g_ballRadius * 7.0f)

So I just changed it from negative to positive, and then switched the keystates in the UpdateFrame() method (line 522-538).

I hope this will suffice for now.
PROBLEM SOLVED!!!!!

Thanks for any attempt on trying to help me solve this. It was actually the easiest solution ever - just added two new key states that handle two keys at once..

Thanks again.

This topic is closed to new replies.

Advertisement