Erik Hofman wrote:
> Martin Spott wrote:
> > Josh Babcock wrote:
> > > The Superfort's flaps and gear are electrically powered, and the
> > > controls for both are instantaneous switches. ie. you have to hold
> > > the switch the whole cycle to keep the motor running.
> >
> > BTW, if someone attempts to create a C150 he'll hit the same obstacle.
> > A general solution might be worthwhile,
> The solution provided by Melchior is the way to go.

Actually, since this is an instantaneous change (i.e. you want to move
it this frame, but don't know how much longer the key or button will
be held down), I'd suggest something more along the lines of
slewProp() in controls.nas.

This function "slews" a property value at a constant rate
(i.e. offsets it by an amount proportional to the current frame
rate) every time it is called.  Docs are in the file:

# "Slews" a property smoothly, without dependence on the simulator
# frame rate.  The first argument is the property name.  The second is
# a rate, in units per second.  NOTE: this modifies the property for
# the current frame only; it is intended to be called by bindings
# which repeat each frame.  If you want to cause motion over time, see
# interpolate().
slewProp = func {
    prop = arg[0];
    delta = arg[1] * getprop("/sim/time/delta-realtime-sec");
    setprop(prop, getprop(prop) + delta);


Flightgear-devel mailing list

Reply via email to