Sign in to follow this  

Moving an object

This topic is 3661 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. 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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

This topic is 3661 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this