Jump to content

XPLMDrawObjects


jimbim

Recommended Posts

Hallo zusammen,

ich habe heute etwas mit XPLMDrawObjects herumgespielt und es nicht zum laufen bekommen...

Ehrlich gesagt habe ich wahrscheinlich auch nicht richtig verstanden, wie es funktioniert...

Mein Ziel ist ein Object (Catering truck) relativ zum Flugzeug zu plazieren.

In Python habe ich das auch schon hinbekommen (Dank dem GroundService Script) als Vorlage.

Eigentlich will ich aber komplett vom Python Interface weg, hin zum reinen FlyWithLua! Das gefällt mir einfach viel besser!

Ich habe viel herum probiert und dazu die "FFI test (Windows only).lua" und "reload scenery.lua" zu Hilfe genommen. LEider ohne großen erfolg.

Nehme ich folgendes:

ffi.cdef( "void XPLMDrawObjects(void)" )

Gibt es Ärger mit der Anzahl der Parameter.

Mache ich es anders:

ffi.cdef[[
void                 XPLMDrawObjects(
                                   XPLMObjectRef        inObject,    
                                   int                  inCount,    
                                   XPLMDrawInfo_t *     inLocations,    
                                   int                  lighting,    
                                   int                  earth_relative);
]]

Wird sofort "XPLMObjectRef" angemotzt. Selbst wenn ich das wiederum mit ffi.cdef deklariere geht es nicht. Eventuell geht es auch gar nicht... keine Ahnung.

Hier mein aktueller, selbstverständlich nicht lauffähiger Stand:

ffi = require( "ffi" )
local C = ffi.C


--ffi.cdef("void XPLMDrawObjects(void)")

--ffi.cdef("void XPLMObjectRef(void)")


ffi.cdef[[
void                 XPLMDrawObjects(
                                   XPLMObjectRef        inObject,    
                                   int                  inCount,    
                                   XPLMDrawInfo_t *     inLocations,    
                                   int                  lighting,    
                                   int                  earth_relative);
]]

if SYSTEM_ARCHITECTURE == 64 then
    XPLM = ffi.load( "XPLM_64" )
else
    XPLM = ffi.load( "XPLM" )
end

dataref("x_pos", "sim/flightmodel/position/local_x")
dataref("y_pos", "sim/flightmodel/position/local_y")
dataref("z_pos", "sim/flightmodel/position/local_z")
dataref("theta", "sim/flightmodel/position/theta")
dataref("psi", "sim/flightmodel/position/psi")
dataref("phi", "sim/flightmodel/position/phi")

catering = "Custom Scenery/OpenSceneryX/objects/airport/vehicles/catering/medium/lsg_sky_chefs/1/stowed/object.obj"

--local posi = {x_pos, y_pos, z_pos, theta, psi, phi}
local posi = {}

posi[0] = x_pos
posi[1] = y_pos
posi[2] = z_pos
posi[3] = theta
posi[4] = psi
posi[5] = phi

XPLM.XPLMDrawObjects(catering, 1, posi, 0, 0)

Wie gesagt, ich habe es wahrscheinlich einfach nicht verstanden :-) Eventuell kann ja jemand helfen :-)

Viele Grüße,

Sebastian

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy & Terms of Use