while im setting up my project, but for some reason the camera direction always becomes (0,0,1) when the scene is done loading. How do I fix this? (the camera position sets properly, its just looking the wrong way. Also camera will be fixed for the whole program, so no need to move it around).
I don't really understand the camera code and hit the same problem a while ago. Never did really work out how to use setDirection, but managed to get round it by using the cam.lookAt( … ) or cam.setFrame( … ) instead.
Couple of followup questions if I may as the whole maths side of 3d is the bit I struggle with most so always looking for a good explanation of stuff that doesn't make sense to me
What is the purpose of the up and left vectors for the camera object? As I see it all a camera really needs is a position to place it and a direction to point it in so it seems the setLocation and the setDirection should be enough?
In your (basixs) example above, when creating the "look at" vector, what is the purpose of the normalize and scale step as it seems to work just fine without it? (or is it just to give better precision in later calculations?)
In your (basixs) example above, when creating the "look at" vector, what is the purpose of the normalize and scale step as it seems to work just fine without it?
That's because it was a normalized vector to begin with (which directions should be anyways, so basically its just a 'safety'); one could supply (100, 0, 100) which normalized would be (0.5, 0, 0.5).
But basically its doing this: normalizing the vector (length == 1), then multiplying it to 'add' the distance.
As I see it all a camera really needs is a position to place it and a direction to point it in so it seems the setLocation and the setDirection should be enough?
Allow the camera to 'roll' in your mental image of how the camera is working and you should see why they are needed.
ok figured out what my particular problem was. I was using camera and cameraNode, and I didn't call cameraNode.UpdateFromCamera(). Everything works peachy now.