Direct3D 9 and 360 degrees

Started by
31 comments, last by theo2005 12 years ago

say you want to look ahead of you in the Z direction when you first start your program, you use the inverse spherical coordinates on the (0, 0, 1) vector, and obtain the correct two angles).


How would I go about doing this in my program? And which vector are you referring at exactly?


LookX = cos(AngleX) * sin(AngleY);
LookY = cos(AngleY);
LookZ = sin(AngleX) * sin(AngleY);


Yup, this seems to work as well.


I am not sure what you are looking for anymore. What is your goal? I was under the impression you wanted to implement a first-person perspective camera, where you use the keyboard to move the camera around the world and the mouse to look around (much as you would in any 3D first-person game). Please correct me if I was wrong because this is what I'm working under.


My goal is to have a camera to look around in the world freely. But even so,
I'd love to have the camera pointing in the direction << I >> personally choose.
-----------------

The reason I also want to have the ability to choose where I look at, is because
then I can later use it to convert to 3rd person camera. My idea of it was to
make the camera follow the player from a certain distance and stay looking at
the character just by supplying the character movement values to the view vector.
But due to the fact that MY common logic does not work here, I deduce that just
putting the character movement values into the view vector will be of no good, thus
I still need to work with the formula you supplied me.

The problem is, the only way
I currently know how to make it point where I want, is multiplying one formula
for the chosen axis with the float number where I want it to point. That of course
breaks the camera view movement and yields incorrect results.

So the conclusion is that I was happy when the camera view movement finally worked, but at
the same time confused and disappointed that I have no means to choose the direction.
I thought that it might be okay if it's only to look around the world, but then I realized that
I wont be able to make a 3rd person camera.

--------------

The reason I might have confused you is because I never thought, nor still think of my current camera as a 1st person camera.
I think of it as spectator mode, or just a camera to look around the world. It highly upsets me that not only I cannot set where I look at
initially, but when I change the initial camera location (move values), even my camera view movement will become inverted on one axis.
(Let alone that for some reason increasing the value on Y axis will make the camera go up, but increasing the value on X axis will make the camera move LEFT not right.)
So.. I'm lost in a mystery.
Advertisement
You can get a view direction from some angles, and you can invert this process to get the appropriate angles for a view direction... or just set an initial direction that you like the look of?

You can get a view direction from some angles, and you can invert this process to get the appropriate angles for a view direction... or just set an initial direction that you like the look of?


"Some angles"?
Please do show me how to set the initial direction in my code.

This topic is closed to new replies.

Advertisement