1
0
Fork 0
Commit graph

42 commits

Author SHA1 Message Date
mfranz
58897fb5f4 revert init signal change -- better fix the real problem 2008-12-19 20:52:22 +00:00
mfranz
2d37f6c60b - remove menu greying out (there's no such entry any more)
- start dynamic view at fdm-initialized to avoid nasal errors (math.cos)
2008-12-18 13:05:56 +00:00
mfranz
1e5cf9ff0a more use of initNode & some consistency improvements (method format) 2008-11-26 16:09:16 +00:00
mfranz
55b7e3d8e0 dynamic_view.nas: use D2R/R2D constants
globals.nas: move constants to top
geo.nas: fix comments & make bucket_span "private"
2008-11-20 20:18:39 +00:00
mfranz
b94a02a4f5 disable ground steering head turn (until there's a better implementation?).
This does often work badly, especially in seaplanes.
2008-02-07 15:07:09 +00:00
mfranz
99bcbe8ea5 change global dynamic-view flag from /sim/view[0]/dynamic/enabled to
/sim/current-view/dynamic-view. There are additionally <dynamic-view>
settings per view, but those only enable it for that view if it's
globally turned on.
2007-11-03 14:08:39 +00:00
mfranz
2bcddab9b6 setlistener(): accessing the node via cmdarg() is now depreciated. Use
a regular function argument for that. Note the "n" in this example:

   setlistener("/sim/current-view/view-number", func(n) {
       setprop("/sim/hud/visibility", !n.getValue());
   }, 1);
2007-10-15 18:27:42 +00:00
mfranz
a895da0247 can't use props.getNode() on the top level ... 2007-10-03 19:14:04 +00:00
mfranz
0f69bc55ef enable dynamic view not only for view[0], but for all views with set
"config/dynamic-view" bool
2007-10-03 17:33:42 +00:00
mfranz
5f97465d6e - make view_manager singleton class
- simplify lookat wrapper with a call()
- cosmetics
2007-05-11 18:59:34 +00:00
mfranz
8f977f33ff - immediately unfreeze when mouse mode changes to a non-pointer mode
- rename variable s/speed/time/
2007-02-23 22:17:55 +00:00
mfranz
dfb4316b43 - make duration of view change configurable (default 0.2 seconds)
- extract some constants
2007-02-11 16:56:15 +00:00
mfranz
7763462f24 - add some documentation
- reset values
2007-02-10 23:47:02 +00:00
mfranz
7f30f1599e prevent math.ln(0) 2007-02-10 20:42:36 +00:00
mfranz
892f665997 small fix; need to remove the whole silly wrapper, anyway 2007-02-09 18:10:22 +00:00
mfranz
4b7c559b69 - extend lookat() function: dynamic_view.lookat(hdg, pitch, roll, x, y, z [, fov])
- use extra function for resuming normal mode after lookat: dynamic_view.resume()
- add fov (field-of-view) to interface:  me.fov_offset
- remove register_headshake and me.headshake; this can still be done via
  normal register(). If only headshaking is to be added, while keeping default
  plane view, do this:

  dynamic_view.register(func {
      default_plane();
      me.x_offset = ...
      me.y_offset = ...
      me.z_offset = ...
  });
2007-02-08 22:16:10 +00:00
mfranz
12f5714b37 add support for x/y/z axes. The built-in function is (still) a NOOP, but
aircraft can plug a custom function. This function can access all internal
variables of the ViewManager class. It can set me.{x,y,z}_offset, and also
add offsets to me.{heading,pitch,roll}_offset. Example:

dynamic_view.register_headshake(func {
        me.x_offset = rand() * 0.02;  # Parkinson effect
});

The advantage of this implementation is that it doesn't break MMB drag
functionality, and that is can be frozen by mouse movements.
2007-02-07 22:13:51 +00:00
mfranz
a1556fa69a make lookat work correctly for when the user changed view direction;
Remember: dynamic_view.lookat(heading, pitch, roll) moves view
smoothly to this direction, while dynamic_view.lookat() moves it back.
This can be used for quick view changes to the panel etc. It's currently
only used in the bo105 (flaps-up binding).
2007-02-07 16:58:46 +00:00
mfranz
e034e66c57 interpolate between frozen or lookat direction and current view direction 2007-02-06 16:25:44 +00:00
mfranz
df1bd972f8 - fix reinit/reset (has this caused the spinning view on reset for some?)
- add var to module functions to avoid conflicts with module names
2007-02-06 14:33:59 +00:00
mfranz
c9db8c22a3 don't waste time when we aren't in dyn-view mode at all 2007-02-05 22:59:51 +00:00
mfranz
286629c3e1 oh, and freeze while a button is pressed in arrow mode ... 2007-02-05 20:57:19 +00:00
mfranz
ea2d56aa33 don't generally freeze dynamic_view in arrow mouse mode, but only a short
time after mouse movements or clicks. After that period a rather ugly jump
happens. TODO: make this smoother
2007-02-05 20:36:29 +00:00
mfranz
90100e2514 disable dynamic view in mouse arrow mode. Operating all the tiny switches
on 3d panels while hopping over bumpy terrain has become difficult -- much
harder than in real life. I'm open for better solutions. Just complain. :-)
2007-02-05 16:14:51 +00:00
mfranz
f376ea5adb use /sim/signals/nasal-dir-initialized signal to simplify things 2007-01-22 00:03:07 +00:00
mfranz
30ce4f68c2 - make register() method more tolerant
- cosmetics
2006-12-11 18:37:10 +00:00
mfranz
ddc4b4c8e5 fix lookat() method (didn't consider unmanaged view "goals") 2006-12-10 23:09:42 +00:00
mfranz
bfacf76538 change per-aircraft configuration to a single function object that is
registered with dynamic_view.register() and is called in the main loop,
replacing the default plane/helicopter function. This has access to
all class functions/members and sets me.heading_offset, me.pitch_offset,
and me.roll_offset, which are then used as new view offsets.
The function can also do other things, such as call the lookat() method
to temporarily set heading and pitch. See the bo105 for an example.

While further minor changes are to be expected, the configuration method
seems to be the way to go.
2006-12-10 21:50:59 +00:00
mfranz
0529f66842 - first stab at making dynamic view parameters configurable on a per-aircraft
basis; see bo105.nas for an example; expect some changes, though
- move "lookat" feature here from bo105.nas (used by "flaps up" bindings)
2006-12-09 22:42:13 +00:00
mfranz
354a0f59ff make if-branch for helicopters (bo105 settings) and for everything else;
this *really* needs to be made configurable and less hackish
2006-12-07 22:38:07 +00:00
mfranz
c5ac5639a0 reset view after reinit (slowly, because the lowpass filters need to catch up) 2006-12-03 23:59:50 +00:00
mfranz
dabf3f300c - aircraft.nas: add variable-interval EWMA lowpass filter class
- dynamic_view.nas: use aircraft.lowpass() class

This makes the dynamic view independent of the frame rate. Currently,
each filter instance reads out dt on its own, which is a bit inefficient.
I'll change that to just one read for all instances later (when Nasal
implemented predictable module loading order. :-)
2006-11-03 17:38:32 +00:00
mfranz
0ff3f5da2b boring cleanup 2006-11-02 21:06:36 +00:00
mfranz
d27df588a6 reduce slip effect speed (harrier VTOL) 2006-08-24 20:55:18 +00:00
mfranz
11dc7c5bcd - let Input class use Lowpass class
- preparation for configurability
- documentation/cleanup
2006-08-22 10:06:46 +00:00
mfranz
f3d14c408a - only allow dynamic view on some fdms, and disable menu entry on others
- decrease heading-due-to-sideslip
2006-08-21 09:45:48 +00:00
mfranz
07f5dd24f3 use sideslip for heading offset in-air, and heading change rate on-ground.
Unfortunately, this is quite jittery on some aircraft, so it uses a slower
lowpass filter. I'd like to fix that, but don't even know what causes it.
Considering /sim/time/delta-realtime-sec didn't help.  :-/
2006-08-19 22:24:24 +00:00
mfranz
28a7b8cb6b - initialize a few properties that can be nil at startup
- start script at settimer(..., 0)
- fix heading mistake
- cleanup
2006-08-18 17:00:16 +00:00
mfranz
8a31fbaae4 simpler & faster 2006-08-17 22:58:06 +00:00
mfranz
94835bb4e4 move the listener settings into the timer, as we don't know at that time
if globals.nas was already loaded
2006-08-17 18:53:44 +00:00
mfranz
8b77679c06 - don't update view as long as mouse button 0 is pressed (otherwise closing
the A-10 canopy is a bit difficult :-)
- reduce pitch-due-to-z-accel a bit
2006-08-17 16:42:00 +00:00
mfranz
1a6a1a6436 first stab at generic dynamic view handling; can be turned on/off via menu
entry "View->Toggle Dynamic Cockpit View" entry; state saved to autosave.xml;
there are no configuration parameters yet, but the default values work for
most aircraft; exceptions: ground steering effect of jsbsim aircraft is
jittery; yawing effect on big aircraft is too abrupt. This needs to be
configurable.
Suggestions for improvements are welcome if they are bundled with a
working diff that actually proves the claimed advantages.   :-)
2006-08-17 15:59:44 +00:00