This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > VRML > December 2003 > Interpolator key question





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Interpolator key question
John Öström

2003-12-04, 1:00 pm

My VRML world has an animation which uses both PositionInterpolator and
OrientationInterpolator. They both use the same keys for the keyValues. To
make the VRML-file more compact (there are a lot of points in these
interpolators!) I'd like use one key(set) for both of them since the values
are the same. Is this possible ? How should this be done ?

I also draw the model tracjectory using IndexedLineSet. Obviously the
coordinate points are the same as the keyValues in the PositionInterpolator.
Could I somehow use one set of value for both of them ? How should this be
done ?

Thanks,
John


Herbert Stocker

2003-12-04, 1:00 pm

Hi,

John Öström wrote:
quote:

> My VRML world has an animation which uses both PositionInterpolator and
> OrientationInterpolator. They both use the same keys for the keyValues. To
> make the VRML-file more compact (there are a lot of points in these
> interpolators!) I'd like use one key(set) for both of them since the values
> are the same. Is this possible ? How should this be done ?
>



Combine a PositionInterpolator and an OrientationInterpolator
into a PosOriInterpolator:


PROTO PosOriInterpolator
[
exposedField MFFloat key []
exposedField MFVec3f keyValuesPos []
exposedField MFRotation keyValuesOri []

eventIn SFFloat set_fraction
eventOut SFVec3f position_changed
eventOut SFRotation orientation_changed

]
{
PositionInterpolator
{
key IS key
keyValue IS keyValuesPos

set_fraction IS set_fraction
value_changed IS position_changed
}

OrientationInterpolator
{
key IS key
keyValue IS keyValuesOri

set_fraction IS set_fraction
value_changed IS orientation_changed
}
}

After this you can say:

PosOriInterpolator
{
key [ 0 .1 ... 1 ]
keyValuesPos [ 0 0 0, 1 1 1, ... ]
keyValuesOri [ 0 0 1 0, 0 0 1 .5, ... ]
}


Another solution is to store the key values in a Script node
and use the initialize() function to send them to both, the
PositionInterpolator and the OrientationInterpolator.

quote:

> I also draw the model tracjectory using IndexedLineSet. Obviously the
> coordinate points are the same as the keyValues in the PositionInterpolator.
> Could I somehow use one set of value for both of them ? How should this be
> done ?
>



A Script that sends the coordinates to the PositionInterpolator
and the IndexedLineSet, or a Script that reads the coordinates from
the PositionInterpolator and assigns them to the IndexedLineSet
would do the trick.

Herbert

--
Herbert Stocker (aka hersto)
http://www.hersto.de
www.bitmanagement.de

John Öström

2003-12-04, 1:01 pm

Thanks for your help. Combining position and orientation interpolator keys
worked just like you said!

"Herbert Stocker" <hst-uzd-nospam@hersto.de> wrote in message
news:3FCA7751.9090204@hersto.de...
quote:

>
> ...a Script that reads the coordinates from
> the PositionInterpolator and assigns them to the IndexedLineSet
> would do the trick.



Ok. I wouldn't like to bother you guys too much but how do I do this kind of
a script ? I'm a newbie using VRML and Java... Just a basic idea would help
a lot.

John


Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews