Help, my camera is not moving correctly!

Started by
11 comments, last by LancerSolurus 10 years, 9 months ago

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

Advertisement

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.

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.

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?

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?

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

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


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


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

Try inverting your camera/view matrix.

Cheers!

This topic is closed to new replies.

Advertisement