Is there a particular reason that the camera controls for the FPS camera are located in the CharacterControllerInput.cs class instead of in the Camera class? The Free and Offset camera input are located in the Camera class, but not for the CharacterController - just wondering if there is a reason such as threading, or if it is safe to move the Camera logic into the Camera class from the CharacterController class.
Also, I notice you calculate your world matrix for the camera (using yaw, pitch, and position), then get the view using "ViewMatrix = Matrix.Invert(WorldMatrix)". If I were to create a ViewMatrix first (for the purposes of a chase camera, using CreateLookAt in XNA), could I get the camera WorldMatrix by using "WorldMatrix = Matrix.Invert(ViewMatrix)"? I've done some research and it seems Matrices are mutually invertable like that. Do you think that would make sense? Thanks!
Quick camera questions
Re: Quick camera questions
The reason for the camera control distribution is that the demos have been built up incrementally over multiple years and sometimes things get put in weird places. (If I spent the 10 minutes to redo the demos camera handling, I'd probably pull the camera controls out of the camera itself, separating control from supporting systems.)Is there a particular reason that the camera controls for the FPS camera are located in the CharacterControllerInput.cs class instead of in the Camera class? The Free and Offset camera input are located in the Camera class, but not for the CharacterController - just wondering if there is a reason such as threading, or if it is safe to move the Camera logic into the Camera class from the CharacterController class.
Also, be aware that the physics engine itself has no concept of the camera or graphics. You are free to do whatever you want with them, it won't mind- it's blind!
You can indeed invert the view matrix to get the world matrix. You can think of the view matrix as pulling objects from world space into camera/view space; the inverse transform pulls objects from camera/view space into world space.Also, I notice you calculate your world matrix for the camera (using yaw, pitch, and position), then get the view using "ViewMatrix = Matrix.Invert(WorldMatrix)". If I were to create a ViewMatrix first (for the purposes of a chase camera, using CreateLookAt in XNA), could I get the camera WorldMatrix by using "WorldMatrix = Matrix.Invert(ViewMatrix)"? I've done some research and it seems Matrices are mutually invertable like that. Do you think that would make sense? Thanks!
Re: Quick camera questions
Thank you for a very prompt and thorough answer! I am in the process of breaking out the camera mechanism (well, I will be now) and will share it when done, if you're interested. Thanks again!