# HG changeset patch # User Robert McIntyre # Date 1320371241 25200 # Node ID b1bc965a38d2e8335ce7908c4abe68da469870ba # Parent 58386a64d019c849df2904c7b1507344a3c99f12 use reflection to set timer for MotionTrack for now diff -r 58386a64d019 -r b1bc965a38d2 src/com/aurellem/capture/examples/Advanced.java --- a/src/com/aurellem/capture/examples/Advanced.java Thu Nov 03 16:55:43 2011 -0700 +++ b/src/com/aurellem/capture/examples/Advanced.java Thu Nov 03 18:47:21 2011 -0700 @@ -3,6 +3,7 @@ import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; +import java.lang.reflect.Field; import java.nio.ByteBuffer; import java.util.logging.Level; import java.util.logging.Logger; @@ -21,6 +22,7 @@ import com.jme3.audio.AudioNode; import com.jme3.audio.Listener; import com.jme3.cinematic.MotionPath; +import com.jme3.cinematic.events.AbstractCinematicEvent; import com.jme3.cinematic.events.MotionTrack; import com.jme3.material.Material; import com.jme3.math.ColorRGBA; @@ -158,7 +160,20 @@ track.setCurveTension(0.80f); motionControl = new MotionTrack(bell,track); - motionControl.setTimer(new IsoTimer(60)); + + // for now, use reflection to change the timer... + //motionControl.setTimer(new IsoTimer(60)); + try { + Field timerField; + timerField = AbstractCinematicEvent.class.getDeclaredField("timer"); + timerField.setAccessible(true); + try {timerField.set(motionControl, new IsoTimer(60));} + catch (IllegalArgumentException e) {e.printStackTrace();} + catch (IllegalAccessException e) {e.printStackTrace();} + } + catch (SecurityException e) {e.printStackTrace();} + catch (NoSuchFieldException e) {e.printStackTrace();} + motionControl.setDirectionType(MotionTrack.Direction.PathAndRotation); motionControl.setRotation(new Quaternion().fromAngleNormalAxis(-FastMath.HALF_PI, Vector3f.UNIT_Y)); motionControl.setInitialDuration(20f);