
Can you explain how to make an ArcBallCamera using your Camera class? I'm having a ton of trouble getting the math right.


Coordinator
May 5, 2009 at 12:04 AM

Hi, what may be causing problems is that in a Xen camera, you want to be generating a Camera Matrix, not a View Matrix (which is what you'd use in XNA).
The difference being that the view matrix is the inverse of the camera matrix.
A camera matrix is the world matrix of the camera, so it can be treated just like any other world matrix you might be using in your game.
So if you are using a tutorial for an XNA arcball camera, then know the matrix they will be generating will be the inverse of what you want (Matrix.CreateLookAt() in XNA always generates an inverted lookat matrix  which I think is very bad design).
For the implementation, the best bet is to extend the ControlledCamera3D class in Xen.Ex.Camera, and then implement it's update method. Call SetCameraMatrix(ref matrix) or 'CameraMatrix = ...' at the end to set your generated camera matrix.
I've never actually implemented an arcball camera myself, as I've never had the need, so I can't help you out much with the actual implementation...



It's funny i just figured out the CameraMatrix just before reading your post. I found this out cause you actually kind of made a arcball camera in your Tutorial 13 (Updates and Input). Thanks!!

