Free flight camera

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
dweeb
Posts: 14
Joined: Tue Jul 15, 2008 11:17 pm

Free flight camera

Post 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?
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Free flight camera

Post 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
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Free flight camera

Post by Norbo »

Here it is. Let me know if there's any issues.
Attachments
QuaternionCamera.zip
(1.24 KiB) Downloaded 297 times
dweeb
Posts: 14
Joined: Tue Jul 15, 2008 11:17 pm

Re: Free flight camera

Post by dweeb »

Works great! Thanks a lot, probably saved me a week with the sample code you sent me!

Thanks again!
Post Reply