Table of contents Chapter index Previous slide Next slide 450
A sample Java script

Writing program scripts with Java
A sample Java script
public void processEvent( Event event )

{

    ConstSFFloat flt = (ConstSFFloat) event.getValue( );

    float frac = (float) flt.getValue( );



    float y = (float)(4.0 * bounceHeight * frac * (1.0 - frac));



    float[] changed = new float[3];

    changed[0] = (float) 0.0;

    changed[1] = y;

    changed[2] = (float) 0.0;

    value_changedObj.setValue( changed );

}