I believe Sswifty made a flight sim without using quaternions, but other than that I don't know anyone who actually made a working flight sim in B3D.
The math really isn't that bad - It's just newtonian physics, but then again math isn't my strong suit either.
Another useful link:
http://www.astro.ku.dk/~norup/vertigo/vertigo.html
The source isn't that useful except for AIRPLANE.TXT, but the description of the flight model is very interesting(VERTIGO.TXT).
Additionally you should take a look at the aircraft definition files, which shows some interesting aspects of the flight model.
EDIT: Also take a look at the flight sims you own. There's usually a chapter of the manual devoted to the flight model, and possibly the science behind it.
EDIT: An approximation can be made by using both an aircraft model and an unattached pivot with the same center. pitch, roll, yaw of the model changes with speed of the pivot. You then program the pivot to 'follow' the aircraft pitch, roll, yaw with faster response the faster the speed goes. First orient the pivot according to the orientation of the craft, then you move the pivot forward, then you place the pivot.
Something like this... Remember this is CRAP CODE TM
You are free to use and abuse this in any way possible.
This loads 2 meshes and uses one to show where the aircraft is pointing and one to show where the aircraft is actually moving towards.
Cursor keys to steer, A and Z for speed!
Andy
The math really isn't that bad - It's just newtonian physics, but then again math isn't my strong suit either.
Another useful link:
http://www.astro.ku.dk/~norup/vertigo/vertigo.html
The source isn't that useful except for AIRPLANE.TXT, but the description of the flight model is very interesting(VERTIGO.TXT).
Additionally you should take a look at the aircraft definition files, which shows some interesting aspects of the flight model.
EDIT: Also take a look at the flight sims you own. There's usually a chapter of the manual devoted to the flight model, and possibly the science behind it.
EDIT: An approximation can be made by using both an aircraft model and an unattached pivot with the same center. pitch, roll, yaw of the model changes with speed of the pivot. You then program the pivot to 'follow' the aircraft pitch, roll, yaw with faster response the faster the speed goes. First orient the pivot according to the orientation of the craft, then you move the pivot forward, then you place the pivot.
Something like this... Remember this is CRAP CODE TM
You are free to use and abuse this in any way possible.
This loads 2 meshes and uses one to show where the aircraft is pointing and one to show where the aircraft is actually moving towards.
Cursor keys to steer, A and Z for speed!
Graphics3D 640,480 SetBuffer BackBuffer() brush1=CreateBrush() BrushColor brush1,0,255,0 brush2=CreateBrush() BrushColor brush2,255,0,0 brush3=CreateBrush() BrushColor brush3,0,0,255 light=CreateLight() cone=CreateCone( 32 ) ScaleEntity cone, 15,15,15 plane=CreatePlane() Global pivot = LoadMesh("biplane.x") RotateMesh pivot, 0,180,0 Global craft = LoadMesh("biplane.x") RotateMesh craft, 0,180,0 Global camera=CreateCamera(craft) PositionEntity camera,0,1,-10 CameraClsColor camera,50,50,150 PaintEntity plane,brush1 PaintEntity pivot,brush2 PaintEntity craft,brush3 PositionEntity pivot,0,10,0 PositionEntity craft,0,10,0 PositionEntity cone,-10,10,10 While Not KeyDown( 1 ) pitch#=0 yaw#=0 roll#=0 stall=0 If KeyDown( 208 )=True Then pitch#=pitch#-speed# If KeyDown( 200 )=True Then pitch#=pitch#+speed# If KeyDown( 205 )=True Then roll#=roll#-speed# If KeyDown( 203 )=True Then roll#=roll#+speed# If KeyDown( 30 ) And speed#<1.0 Then speed#=speed#+0.01 If KeyDown( 44 ) And speed#>0.0 Then speed#=speed#-0.01 TurnEntity craft,pitch#,yaw#,roll# If EntityPitch#(craft) > EntityPitch#(pivot) Then TurnEntity pivot,speed#,0,0 If EntityPitch#(craft) < EntityPitch#(pivot) Then TurnEntity pivot,-speed#,0,0 If EntityRoll#(craft) > EntityRoll#(pivot) Then TurnEntity pivot,0,0,speed# If EntityRoll#(craft) < EntityRoll#(pivot) Then TurnEntity pivot,0,0,-speed# If EntityYaw#(craft) > EntityYaw#(pivot) Then TurnEntity pivot,0,speed#,0 If EntityYaw#(craft) < EntityYaw#(pivot) Then TurnEntity pivot,0,-speed#,0 If Abs(EntityPitch#(craft) - EntityPitch#(pivot)) > 5 Then stall=1 If Abs(EntityRoll#(craft) - EntityRoll#(pivot)) > 5 Then stall=1 If Abs(EntityYaw#(craft) - EntityYaw#(pivot)) > 5 Then stall=1 MoveEntity pivot,0.0,0.0,speed# PositionEntity craft, EntityX(pivot),EntityY(pivot),EntityZ(pivot) RenderWorld Text 0,10,"Cursor keys for pitch and roll, A and Z for speed Text 0,30,"Pitch: "+EntityPitch(craft) Text 0,40," Yaw: "+EntityYaw(craft) Text 0,50," Roll: "+EntityRoll(craft) Text 0,80,"Speed: "+speed# Text 0,110,"Pitch: "+EntityPitch(pivot) Text 0,120," Yaw: "+EntityYaw(pivot) Text 0,130," Roll: "+EntityRoll(pivot) If stall=1 Then Text 0,0,"STALL STALL STALL STALL STALL" Flip Wend End
Andy