FGCamera: Difference between revisions

Jump to navigation Jump to search
1,583 bytes added ,  8 January 2023
Line 151: Line 151:


Key assignments can be customized by editing ''fgkeyboard.xml'' file inside add-on folder.
Key assignments can be customized by editing ''fgkeyboard.xml'' file inside add-on folder.
= Aircraft integration API =
This chapter documents some integration API for your aircraft Nasal code.
== Walker compatibility callbacks ==
{| class="prettytable"
! align="left" | Callback / Variable
! align="left" | Description
|-
| valign="top" | <code>fgcamera.walker.getOutTime</code>
| valign="top" | wait time in seconds after the <code>getOutCallback</code> executed
|-
| valign="top" | <code>fgcamera.walker.getInTime</code>
| valign="top" | wait time in seconds after the <code>getInCallback</code> executed
|-
| valign="top" | <code>fgcamera.walker.getOutCallback()</code>
| valign="top" | callback  when getting out
|-
| valign="top" | <code>fgcamera.walker.getInCallback()</code>
| valign="top" | callback when getting in
|}
The example code for the Cessna C182S which opens the door if not open yet.
#
# Example to open the door on the C182S/T when getting out or in:
# (this code should go to the aircraft nasal script)
#
if (addons.isAddonLoaded("a.marius.FGCamera")) {
    var planeNamespace = globals[getprop("/sim/aircraft")];
    fgcamera.walker.getOutCallback = func {
        fgcamera.walker.getOutTime = getprop("/sim/model/door-positions/DoorL/opened") == 0 ? 2 : 0;
        c182s.DoorL.open();
    };
    fgcamera.walker.getInCallback = func {
        view.setViewByIndex(110); # so we stay outside (under the hood we are already switched one frame into the pilot seat, which we must roll back)
        fgcamera.walker.getInTime = getprop("/sim/model/door-positions/DoorL/opened") == 0 ? 2 : 0;
        c182s.DoorL.close();
    };
}


= Commands =
= Commands =
1,099

edits

Navigation menu