Syd,
I did some experimenting with the new properties. Here are my results that I
have for the SenecaII:
A nasal mouse motion handler:
var MouseHandler = {
new : func() {
var obj = { parents : [ MouseHandler ] };
obj.property = nil;
obj.factor = 1.0;
obj.YListenerId = setlistener( "devices/status/mice/mouse/accel-y",
func(n) { obj.YListener(n); }, 1, 0 );
return obj;
},
YListener : func(n) {
me.property == nil and return;
me.factor == 0 and return;
n == nil and return;
var v = n.getValue();
v == nil and return;
fgcommand("property-adjust", props.Node.new({
"offset" : v,
"factor" : me.factor,
"property" : me.property
}));
},
set : func( property = nil, factor = 1.0 ) {
me.property = property;
me.factor = factor;
},
};
var mouseHandler = MouseHandler.new();
And the corresponding pick animation in the model gets the action
<action>
<button>0</button>
<repeatable>false</repeatable>
<binding>
<command>nasal</command>
<script>SenecaII.mouseHandler.set(
"/controls/engines/engine[1]/propeller-pitch", 0.01 );</script>
</binding>
<mod-up>
<binding>
<command>nasal</command>
<script>SenecaII.mouseHandler.set()</script>
</binding>
</mod-up>
</action>
This sets a mouse-motion handler when the button is clicked on the control and
removes the mouse-motion handler. The hander executes the property-adjust
command for the given property.
There is no support for the x-axis yet, but probably easy to add. Maybe
something like
mouseHandler.setXHandler( prop, factor );
mouseHandler.setYHandler( prop, factor );
Once this idea has matured a bit, it probably should go into the global Nasal
directory (controls.nas?)
What do you think?
Torsten
> Ive tried a few solutions to zero the properties , but then the
> animation stops working .With the current implementation , the mouse
> can leave the picked object while the button is pressed and continue
> to move the lever , so for the moment this
> seems to work ...
>
> On Sat, Jan 8, 2011 at 1:27 AM, Torsten Dreyer <[email protected]> wrote:
> >> I knew this was too easy , and looking for the reason , but the
> >> acceleration properties don't zero out when the mouse stops moving .
> >> While it still works to a point , still not quite right.
> >
> > Hmm - I have no idea how to solve that. Our mouse motion handler gets
> > called with "last movement since last call", so we might not received a
> > "mouse has stopped" call :-(
> >
> > Torsten
> >
> > -------------------------------------------------------------------------
> >----- Gaining the trust of online customers is vital for the success of
> > any company that requires sensitive data to be transmitted over the Web.
> > Learn how to best implement a security strategy that keeps consumers'
> > information secure and instills the confidence they need to proceed with
> > transactions. http://p.sf.net/sfu/oracle-sfdevnl
> > _______________________________________________
> > Flightgear-devel mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/flightgear-devel
>
> ---------------------------------------------------------------------------
> --- Gaining the trust of online customers is vital for the success of any
> company that requires sensitive data to be transmitted over the Web.
> Learn how to best implement a security strategy that keeps consumers'
> information secure and instills the confidence they need to proceed with
> transactions. http://p.sf.net/sfu/oracle-sfdevnl
> _______________________________________________
> Flightgear-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/flightgear-devel
>
------------------------------------------------------------------------------
Gaining the trust of online customers is vital for the success of any company
that requires sensitive data to be transmitted over the Web. Learn how to
best implement a security strategy that keeps consumers' information secure
and instills the confidence they need to proceed with transactions.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Flightgear-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/flightgear-devel