Page 1 of 1

Free flight camera

Posted: Sun Aug 02, 2009 11:42 pm
by dweeb
Hi

I'm trying to build a space simulator app using your engine and I've ran into a problem with the camera.

Since I need the camera to work as a flight simulator I removed the restriction:
if (pitch > 1.55f)
pitch = 1.55f;
else if (pitch < -1.55f)
pitch = -1.55f;

But this seems to create some problems with the camera. If you rotate it up and around a bit the pitch will soon be inverted and you will get a jerky camera that at some angles jumps between different views.

I've googled a bit on this subject and the suggestion has been to normalize the quaternion's which I've added to the camera but I've still got the same issue.

Do you have any suggestions of what might be wrong with the camera?

Re: Free flight camera

Posted: Mon Aug 03, 2009 12:53 am
by Norbo
The demos camera (both the one in the BEPUphysicsDemos and in the documentation mini-demos) were designed to use Vector3.Up as the camera's up vector, and includes no support for rolling. Using a quaternion to represent orientation won't give any more power without changing the camera's design.

However, I did make a little space game-demo using BEPUphysics a while back which included a simple free-rotating camera. I'll go ahead and fix it up and post it here in a little while. Someday I should get the whole game fixed up so I can release it as a sort of BEPUphysics starter kit. :D

Re: Free flight camera

Posted: Mon Aug 03, 2009 1:49 am
by Norbo
Here it is. Let me know if there's any issues.

Re: Free flight camera

Posted: Mon Aug 03, 2009 9:01 pm
by dweeb
Works great! Thanks a lot, probably saved me a week with the sample code you sent me!

Thanks again!