Tell me more ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I have a custom Panel residing within my WinForm. the custom Panel holds the XNA rendering. So far, I've rendered an 3D test model. What I'm doing now is trying to handle the input.Using a camera from another working game, keyboard input works fine moving the camera in all 6 directions. But when it comes to handling the mouse to yaw and pitch the camera, nothing happens. I've searched about to see if anyone has come across this problem, but found no testable solutions to my problem.

Does anyone understand as to what may be causing the Mouse not to be called when moved?

Within MainForm constructor:

public MainForm()
{
    InitializeComponent();
    Mouse.WindowHandle = panel3D.Handle;
}

Panel3D.cs

Custom XNA Panel class

FreeCamera.cs

FreeCamera class

share|improve this question
add comment

1 Answer

in this line:

87.   view = Matrix.CreateLookAt(freeCamera.Position, freeCamera.Position + Vector3.Forward, Vector3.Up);

The camera target param (freeCamera.Position + Vector3.Forward) will always cause the camera to point forward regardless of rotation. I think what you want is to expose direction_ as a property and use it like this:

87.   view = Matrix.CreateLookAt(freeCamera.Position, freeCamera.Position + freeCamera.direction_, Vector3.Up);
share|improve this answer
 
Thanks for the reply. It didn't work. I may just build a another camera from scratch in a regular XNA project, get it working there, then try to port it into this. –  ChocoMan Aug 20 at 4:52
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.