Hi Ewan,
Actually the fix is more tricky that what I suggest previously,
centerToView should not add to transVector.
The offset part xtrans/ytrans need to compute by
(1) Get the translation component, transVector, of targetTransform
(2) Compute the vector centerToView, from transVector and rotationCenter
which is the offset before the transform.
(3) Transform the above offset with the invert of rotation
component of targetTransform to get the final xtrans/ytrans.
There is also problem in computing the zoom part.
They are fixed in the next v1.3 beta2 release.
Thanks.
- Kelvin
----------------
Java 3D Team
Sun Microsystems Inc.
>Date: Sat, 16 Mar 2002 23:30:48 +0000
>From: Ewan Borland <[EMAIL PROTECTED]>
>Subject: [JAVA3D] Another Orbit Behavior bug?
>To: [EMAIL PROTECTED]
>MIME-version: 1.0
>X-MIMEOLE: Produced By Microsoft MimeOLE V5.50.4522.1200
>Content-transfer-encoding: 7bit
>X-Priority: 3
>X-MSMail-priority: Normal
>Delivered-to: [EMAIL PROTECTED]
>
>I've been using the setHomeTransform() and goHome() methods of
>ViewPlatformBehavior on anOrbitBehavior and getting some strange results.
>
>I should say that I reported an OrbitBehavior bug a couple of months back
>and was given a fix by the J3D team so I'm using a version of OrbitBehavior
>without those bugs (sorry don't have the ID numbers to hand but the message
>will be in the archives).
>
>I'm allowing the user to set the home transform by clicking a button with
>the following actionPerformed method:
>
>public void actionPerformed(ActionEvent ae)
> {
> // Retrieve the current view transform
>
>orbit.getViewingPlatform().getViewPlatformTransform().getTransform(homeTrans
>form);
>
> // Set it as the home transform for the OrbitBehavior
> orbit.setHomeTransform(homeTransform);
>
> } // actionPerformed
>
>Then when the user presses a "Home" button I simply call orbit.goHome() and
>the view transform is indeed set as equired. However depending on the home
>transform I get strange results when the user begins interacting again:
>
>1. If the user has only zoomed before setting the home transform then
>everything works fine.
>
>2. If the user has performed x,y translations before setting the home
>transform then there is a small but perceptible jump in the +ve z direction
>when they interact after having "gone home".
>
>3. If the user has performed any rotations before setting the home
>transform, there is a large jump in either the x, y or both directions
>(normally big enough that any object at the rotation centre goes out of
>view) when they interact after having "gone home".
>
>When I first noticed this I took a quick look at the orbit behavior code. By
>changing
>
> transVector.x = rotationCenter.x + xtrans + centerToView.x;
> transVector.y = rotationCenter.y + ytrans + centerToView.y;
>
>to
>
> transVector.x = rotationCenter.x + xtrans;
> transVector.y = rotationCenter.y + ytrans;
>
>I obviously lost any translation associated with the home transform but all
>other problems vanished .... so maybe there's a problem with the resetting
>of the centerToView translation?
>
>My code's in a big app but I'll try and get a small test as soon as I can if
>necessary.
>Cheers for any help, sorry if someone's already documented this.
>
>Ewan
>
>===========================================================================
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff JAVA3D-INTEREST". For general help, send email to
>[EMAIL PROTECTED] and include in the body of the message "help".
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".