Apparently, I'm retarded.
Long story short: I'm learning how to make DirectX, and making a sprite-based platformer (with C#) as a testing ground. I've made some other simple games before, but this is the first that needs a moving camera. I've been reading tutorials on how to use the camera for the past few hours. Although I would love to be able to understand the subject matter just by reading it, I usually find it helpful to test it as I go along to make sure I know what's happening. Unfortunately, I can't seem to get the camera to do
anything.
Specifically, if I do this:
device.Transform.View = Matrix.LookAtLH(new Vector3(400, 400, 400), new Vector3(0, 0, 1), new Vector3(0, 1, 0));
it does the exact same thing as if I do this:
device.Transform.View = Matrix.LookAtLH(new Vector3(),new Vector3(),new Vector3());
which does the exact same thing as if I do this:
device.Transform.View = new Matrix();
Which is to say, nothing.
The line of code is definitely taking place before the device renders - in fact, I've put them everywhere from right after the creation of the device to right before it renders to right
after it renders
just in case something different happened on the second frame, and nowhere has the code made a difference - so I'm puzzled about why nothing changes no matter how I change the view matrix. At first I thought it might be the Sprite class playing shenanigans on me somehow (because I already know the Sprite class makes the sprites tilt to face the camera), but even after inserting the code into an older project that rendered primitives more directly with a TriangleFan, there's
still nothing that changed.
Either there's something I don't know about but have to set -
somewhere - to make the D3D device use the damned View matrix when it renders, or I
seriously misunderstand how this is supposed to work.
If someone could set me straight either way, that would be great.
Note: I
could post the source code if you really wanted me too, but because I saved this camera thing for just about last the source is
huge right now, confusing because it's my first sidescroller, and completely uncommented. Basically, it's completely illegible. But I'm sure that this doesn't anything have to do with the fact that my code for this project isn't in very good shape - as I said, I can't get the camera to move in any older project I paste any of those lines of code in.
But if you don't have enough to go on based what I told you, I'm obviously not getting
something about the tutorials. As I said, though, I learn much better if I'm actually testing things and changing values to see what exactly does what. But I also can't find any working sample code that is written in C# and not already so complex I don't understand it, which isn't helping.
This is the first real roadblock I've come across since I started this, and because I just spent three hours
failing at making the camera just
pan, I'm a little bit frustrated. Any help would be
greatly appreciated and I will love you forever.
Posts
http://www.thelostworlds.net/
I'll try to whip up a simple program to show what I'm talking about (and I suppose if I end up making a small program for this that works I should be able to figure out my problem from there).
Those changes to device.Transform.View seem to have no effect (when uncommented, of course).
Why am I so stupid that I can't figure out how to make this work
http://www.thelostworlds.net/
Let me see if I can verify that, and/or provide another method.
http://www.thelostworlds.net/
I tried throwing together the other option, where you use point sprites in 3D space, but I couldn't make it happen for some reason and I'm out of time for looking at this today. That would have been a harder method anyway.
http://www.thelostworlds.net/
Thank you very much for helping me out. I probably would've been stuck on this for weeks if I was left to figure it out on my own. I'll have to change the way I did a few things, but I know where to go from here. Thanks again!