[x3d-public] computed orientation_changed output
Andreas Plesch
andreasplesch at gmail.com
Mon Aug 26 12:18:27 PDT 2024
An idea for enhancement:
I had a need for a PositionInterpolator to animate an object (say a
ship). While moving the object around it should align its orientation
with the direction of travel (bow pointing forward) which is often the
case. Rather than precomputing key values for an
OrientationInterpolator to go along with the interpolated positions, I
decided to derive the orientations from the change in positions
dynamically. Perhaps not surprisingly, this required a script. Is
there an existing alternative ? Perhaps via physics ?
The script takes a new position, calculates the direction of travel as
the difference between the new position, and the last position (which
it remembers), and uses a default SAI function to compute the rotation
from the default (0,0,-1) orientation to the new direction. This
sounds pretty straightforward but becomes more complicated for a
GeoPositionInterpolator.
Since aligning orientation with direction of travel is a frequent use
case - including for animated Viewpoints - , the enhancement would be
for nodes such as position interpolators, chasers and dampers, etc. to
provide this orientation directly, perhaps as an additional
orientation_changed event.
An alternative may be use of a TransformSensor which could
additionally provide this information, say as a direction_changed
event.
This may be outside the scope of standard X3D since it may be seen as
a use case for a Script node but is so generally useful that it may
warrant enhancement of existing nodes.
Thanks for reading and any thoughts or criticism,
Andreas
--
Andreas Plesch
Waltham, MA 02453
More information about the x3d-public
mailing list