Jump to content

  • Log In with Google      Sign In   
  • Create Account

Help, my camera is not moving correctly!


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
12 replies to this topic

#1 Esper S.   Members   -  Reputation: 124

Like
0Likes
Like

Posted 13 July 2013 - 07:06 PM

Using DirectX10, I have made a camera that rotates and moves about just fine. The problem is that it seems to be moving relative to the world. Can someone please explain why the camera won't move correctly and the necessary steps to fix this? Thank you, everyone



Sponsor:

#2 lomateron   Members   -  Reputation: 363

Like
0Likes
Like

Posted 13 July 2013 - 07:18 PM

The problem is that it seems to be moving relative to the world---- I don't see any problem there

Can someone please explain why the camera won't move correctly and the necessary steps to fix this?

Insufficient info, impossible to answer question.



#3 Esper S.   Members   -  Reputation: 124

Like
0Likes
Like

Posted 13 July 2013 - 07:28 PM

I'm sorry! I've never used posts like this before. What other info would be required?
The aim was for the camera to move relative to itself. So regardless of the camera's rotation, it still moves "forward" (into the screen?) instead of along the world's z-axis.



#4 lomateron   Members   -  Reputation: 363

Like
0Likes
Like

Posted 13 July 2013 - 07:41 PM

do you have a 3d vector that defines the position of your camera? 

do you have another 3d vector that defines were is the camera looking to?



#5 Esper S.   Members   -  Reputation: 124

Like
0Likes
Like

Posted 13 July 2013 - 07:47 PM

Whoa, that would be helpful! I have D3DXVECTOR3 position, but how would you make one for camera target? Where the camera is looking will change constantly due to mouse input.

Also, what would I do to make the camera go forward in that direction?



#6 lomateron   Members   -  Reputation: 363

Like
0Likes
Like

Posted 13 July 2013 - 08:01 PM

what are you using to learn about directx 10?

 

What I used to start learning directx10 helped me a lot on defining and using those two vectors

 

I used the "Microsoft DirectX SDK (June 2010)"

If you have it go to the windows -Start- button, write in the search bar "directx documentation for c++" 

then go to -samples and tutorials- and then to the -direct3D 10- tutorials

read and you will see how easy is to make a camera



#7 Esper S.   Members   -  Reputation: 124

Like
0Likes
Like

Posted 13 July 2013 - 08:06 PM

I will do my best! btw, I've been using Rastertek tutorials. They're really good! laugh.png



#8 Norman Barrows   Crossbones+   -  Reputation: 2322

Like
0Likes
Like

Posted 14 July 2013 - 11:26 AM


Where the camera is looking will change constantly due to mouse input.
Also, what would I do to make the camera go forward in that direction?

 

there are a number of ways to store camera position and direction. an eye point and a lookat point is one. an x,y,z location and x,y,z rotations is another. matrices and quaternions are other possibilities. i use an x,y,z location, and x and y rotation for a FPS type game.

 

use mouse delta to update x and y rotation values.

 

to move in 2d:

x+=speed*cos(y rotation);

z+=speed*sin(y rotation);

y=heightmap_of(x,z);

 

3d is a bit more complex. the delta values for x,y,and z are the 3d unit direction vector of the camera * speed, projected onto the x,y,and z axes.


Norm Barrows

Rockland Software Productions

"Building PC games since 1989"

rocklandsoftware.net

 

PLAY CAVEMAN NOW!

http://rocklandsoftware.net/beta.php

 

 


#9 Norman Barrows   Crossbones+   -  Reputation: 2322

Like
0Likes
Like

Posted 14 July 2013 - 11:34 AM


I will do my best! btw, I've been using Rastertek tutorials. They're really good! 

 

watch out for bugs / errors / omissions / just plain wrong code. i've noticed a few. frustum culling had some as i recall. but overall, Rastertek is probably better than most out there.


Norm Barrows

Rockland Software Productions

"Building PC games since 1989"

rocklandsoftware.net

 

PLAY CAVEMAN NOW!

http://rocklandsoftware.net/beta.php

 

 


#10 kauna   Crossbones+   -  Reputation: 2853

Like
0Likes
Like

Posted 14 July 2013 - 01:45 PM

Try inverting your camera/view matrix.

 

Cheers!



#11 Muzzy A   Members   -  Reputation: 689

Like
0Likes
Like

Posted 14 July 2013 - 06:33 PM

Changing the translation of the view matrix should do everything just fine for you. Seems to me like you were changing the inverse camera's translation.



#12 Tispe   Members   -  Reputation: 1046

Like
0Likes
Like

Posted 15 July 2013 - 04:48 AM

You can have Camera Position and Direction vectors. If you press your forward key, then the new camera position would be "(Position+Direction)*ElapsedTime". The direction should be normalized.

 

You can use delta mouse to rotate direction vector.



#13 LancerSolurus   Members   -  Reputation: 616

Like
0Likes
Like

Posted 15 July 2013 - 05:11 AM

Since you haven't posted any code as to how you are deriving you camera view, everyone here is just guessing as to what your problem is. Post your code so we can see what your problem is.


******************************************************************************************
Youtube Channel





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS