Skip to main content

Return to original view point

2 replies [Last post]
Joined: 2006-02-17

Hi guys,

I used MouseRotation and MouseTranslation behaviors in my program, but the problem is that the user often messes with the view, but then wants to return to the original view point....does anyone know a smooth way of doing this? I want the view to smoothly return to the original orientation. Perhaps an example or some sample code exists out there that I have not yet found.

thanks a billion in advance,

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2004-09-12

You could store your original view point and view direction and change the current view point and view direction stepwise until its the same as the original.
That means you have to calculate the distance of the view points and the angles of the two view directions and split them up into as much pieces as you want (depending on the smoothness or speed of the transition) and then add a timer who adds at several time steps the calculated pieces to the current view point and direction. That mean change the TransformGroup/s of your view. Instead of storing the point and view direction you could just store your view transformation matrix and do thh thing above with the two different matrices.


you can also add a RotPosScalePathInterpolator to the Root of the scenegraph with interpolator.setEnable(false); and an Alpha object. Make sure that you define the default position, rotation, and/or scale. After the scene changed, get the currentMatrix containing last Transformation and pass the params to Interpolator with setEnable(true);