how to make / scripting flight sim?

Hi.
I got a project from my teacher to make flight sim.
And I am already make model f-22 raptor aircraft.
Can somebody teach me how to make flight sim from takeoff until it landing (include rotate and etc)?
I’m searching from google and I can’t find reference to make it until now.
Please help me

I really need a help.

I would use rigid bodies and forces for most of it, and then use python to control the angles of the flaps/rudder and the throttle is easy enough in logic, lift can be done by adjusting a force the faster the craft goes, from 0 lift at 0 to 9.8* weight of the craft above stall speed, with python

need some help from here?

Here I have a little helicopter/airplane hybrid prototype.

It is a pretty simple script based on using forces to provide movement.

import bge
from math import pow, sqrt
from mathutils import Vector

def main():
    cont = bge.logic.getCurrentController()
    heli = cont.owner
    
    #Drag
    vel = heli.getLinearVelocity(False)
        
    powxyz = pow(vel.x,2) + pow(vel.y,2) + pow(vel.z,2)
    speed = sqrt(powxyz)
    
    k=0.4
    force = k*speed
    
    vecx = Vector((1,0,0))
    
    heli.applyForce(k*-vel, False)
    heli.applyForce(force*vecx, True)
    
    
    #Input
    keyboard = bge.logic.keyboard
    
    wKey = bge.logic.KX_INPUT_ACTIVE == keyboard.events[bge.events.WKEY]
    sKey = bge.logic.KX_INPUT_ACTIVE == keyboard.events[bge.events.SKEY]
    aKey = bge.logic.KX_INPUT_ACTIVE == keyboard.events[bge.events.AKEY]
    dKey = bge.logic.KX_INPUT_ACTIVE == keyboard.events[bge.events.DKEY]
    
    upKey = bge.logic.KX_INPUT_ACTIVE == keyboard.events[bge.events.UPARROWKEY]    
    downKey = bge.logic.KX_INPUT_ACTIVE == keyboard.events[bge.events.DOWNARROWKEY]
    leftKey = bge.logic.KX_INPUT_ACTIVE == keyboard.events[bge.events.LEFTARROWKEY]        
    rightKey = bge.logic.KX_INPUT_ACTIVE == keyboard.events[bge.events.RIGHTARROWKEY]
    
    mov = 0.1
    
    if wKey:
        heli.applyForce((20,0,3), True)
    if sKey:
        heli.applyForce((0,0,-3), True)
    if aKey:
        heli.applyTorque((0,0,.5), True)
    if dKey:
        heli.applyTorque((0,0,-.5), True)
        
    if upKey:
        heli.applyTorque((0,.5,0), True)
    if downKey:
        heli.applyTorque((0,-.5,0), True)
    if leftKey:
        heli.applyTorque((-2,0,0), True)
    if rightKey:
        heli.applyTorque((2,0,0), True)
        
    heli.applyForce((0,0,9.8),True)

main()

Here is a rig I have worked out,

it still needs mouse control but otherwise wala :slight_smile:

Attachments

Jet.blend (1.05 MB)

update :More moreness

yes sir, more reference are good
please, I beg you sir

Thank you sir, its really helpful :slight_smile:

Thank you sir, btw can you help me more for controlling using joystick?
my teacher order me using joystick handle
I got joystick Logitech extreme 3D pro in my home

w(T^Tw)

Ok

Re: Help abit more about flight simStart with your “thrust” logic

Jet
properties_________________

Thrust integer
Lift
Altitude
Speed

Keyboard Pullup ----------------------------------------------------------------------and-----------------motion y axis AngleV .5 (local)
Keyboard Dive ----------------------------------------------------------------------and--------------------motion y axis AngleV -.5(local)
Keyboard Right ----------------------------------------------------------------------and-------------------motion Z axis AngleV .5 world
Keyboard Left ----------------------------------------------------------------------and-------------------motion Z axis AngleV -.5 world
Keyboard Throttle_UP-------------------------------------------------------------and-----------------------property Add 1 to thrust
(property interval) thrust Min=0 (Max =(1 less then max thrust)-/

Keyboard Thrust_Dwn-----------------------------------------------------------and---------------------property Add -1 to thrust
(property interval) thrust Min=1 Max = max thrust--------------------/

Always--------------------------------Python -Lift Code

Python______
import bge

def main():

cont = bge.logic.getCurrentController()
own = cont.owner
Thrust = own[‘thrust’]
sens = cont.sensors[‘Always’]
actu = cont.actuators[‘Motion’]
Speed0 = own.getLinearVelocity(0)
Speed0.z = Speed0.z0
speed2 = Speed0.length
own[‘Lift’]=speed2
.25
own[‘Speed’]=speed2
own[‘Alt’]=own.worldPosition.z
own.applyForce((Thrust,0,speed2*.05),True)
if sens.positive:
cont.activate(actu)
else:
cont.deactivate(actu)

main()

FILE

It’s work sir!
But, something happen when my handle on free position (not move or original position) after i use this script
Joystick | Axis | Up Axis (keyboard dive) ----------------------------------------------------------------------and--------------------motion y axis AngleV -.5(local)
It’s keep move diving, not on position moving straight
what is the problem?