Thanks, I have tried further with your code but it didn't work correctly. I don't know why. Now I have solved it in another way. The scene orbits around the picked point and performs exactly as it should be. Here is the code what I have used: private void calcTransformOrbit() { Transform3D tempT3D = new Transform3D(); Transform3D orbitT3D = new Transform3D(); double factor = 0.001; tempT3D.rotX( -dyMouseMove * factor ); orbitT3D.mul( tempT3D ); tempT3D.rotY( -dxMouseMove * factor ); orbitT3D.mul( tempT3D ); Vector3d pickedPointVec = new Vector3d(); if( pickedPoint != null ) { pickedPointVec.set( pickedPoint ); } //get the old view platform transform data Transform3D viewPlatformT3D = new Transform3D(); viewPlatformTG.getTransform( viewPlatformT3D ); Vector3d tempVec = new Vector3d(); viewPlatformT3D.get( tempVec ); //rotate the view platform about the picked point viewPlatformT3D.setTranslation( pickedPointVec ); viewPlatformT3D.mul( orbitT3D ); //rotate the view point about the picked point tempVec.sub( pickedPointVec ); orbitT3D.transform( tempVec ); tempVec.add(pickedPointVec); viewPlatformT3D.setTranslation( tempVec ); currentVpT3D.set( viewPlatformT3D ); } Btw, there was confusion with the field dx and dy in my old code but the factors for rotX and rotY that I have used were correct. Now I have used new field names for the factors in the new code above and the meaning of the factors are more obvious. Best regards, Bo -----Ursprüngliche Nachricht----- Von: Eric Reiss [mailto:[EMAIL PROTECTED]] Gesendet: Freitag, 15. Dezember 2000 18:45 An: [EMAIL PROTECTED] Betreff: Re: [JAVA3D] ???? [JAVA3D] "better" PickRotateBehavior ???? First, I think you are performing the rotX and rotY methods on the wrong factors. When you drag in the x direction of the screen, this is a rotation of the object around the Y axis with respect to the screen. A y drag rotates an object around the X axis with respect to the screen. (Compare this with Sun's MouseRotate behavior) I am not familiar with the yaw and pitch terminology so maybe you are right if a mouse drag along the x axis of the screen is what you are calling dy and likewise for the other drag direction. The rest of your code looks exactly like mine (which absolutely does work) with the exception of one line. You have the following line commented out: // tg_ghost.setTransform(tg_ghost_T3D); // Needs to accumulate for next drag This line is right before the section that says: // Now do this for the viewer The rotations on this TransformGroup need to accumulate. That is why in my code the variable tg_ghost is a Class Field so that its value is remembered from one processStimulus to the next. The way I implemented it is that when a user picks and object, the TransformGroup of the object is gotten and the setTransformGroups() method of the MouseOrbit behavior is called. This setTransformGroups() method tells the behavior which object's TransformGroup to operate on and tells it what the viewplatform's TransformGroup is. Then as the mouse is dragged around on the screen, multiple calls to processStimulus occur and the rotations of the tg_ghost are being saved because it is a Class Field. Otherwise the previous value is lost from one call to processStimulus to the next. When a user picks a different object, they must call the setTransformGroups() method again which reinitializes tg_ghost so that it can accumulate the rotations as the mouse is dragged for that object. I recall taking this line out at one point during testing and the object just appeared to shudder in place (actually it was the viewer moving back and forth). What was happening is that as I dragged the mouse a small amount, the processStimulus was called, which moved the viewer and then it would snap back into its original place. The processStimulus method would be called again, resulting in a small movement and then snapped back again. I don't think the second example will work because you perform the rotations with the positions included. This usually sends objects off on wild paths instead of orbits. You need to save position information and set the position parts of the matrices to 0, then after figuring out the orbit information, reapply the position info. PS. Be sure you have multiple objects in the view when you try to orbit. Having one at the origin is very helpful. If you have one object on the screen, you can't tell if the object is rotating or if you are orbiting the object. At 03:29 PM 12/15/2000 +0100, you wrote: >Hi, > >I have tried to use Eric's code of 'MouseOrbit.java' for >rotating the view around a picked point. But this does not >work as it should do. > >Instead of the TransformGroup of the center point I have used >directly the picked point as orbit center point and set it as >translation in the Transform3D of the 'tg_ghost_T3D'. > > private void calcTransformOrbit() { > > double dy = yawAngleDelta; > double dx = pitchAngleDelta; > > Transform3D tempT3D = new Transform3D(); > Transform3D orbitT3D = new Transform3D(); > > tempT3D.rotX(dx); > orbitT3D.mul(tempT3D); > tempT3D.rotY(dy); > orbitT3D.mul(tempT3D); > > Transform3D tg_ghost_T3D = new Transform3D(); >// viewPlatformTG.getTransform(tg_ghost_T3D); > if( pickedPoint != null ) { >// Transform3D currXform = new Transform3D(); >// viewPlatformTG.getTransform(currXform); >// currXform.transform(pickedPoint); > tg_ghost_T3D.setTranslation(new Vector3d(pickedPoint.x, >pickedPoint.y, pickedPoint.z) ); > } >// tg_ghost.getTransform(tg_ghost_T3D); > Vector3f tg_ghost_vec3f = new Vector3f(); > tg_ghost_T3D.get(tg_ghost_vec3f); // Save the >tg_ghost_vec3f for later > Matrix4d tg_ghost_mat4d = new Matrix4d(); > tg_ghost_T3D.get(tg_ghost_mat4d); // Save the >tg_ghost_mat4d for later > > Transform3D VPTG_ghost_T3D_inverted = new Transform3D(); > Transform3D VPTG_ghost_T3D_noninverted = new Transform3D(); > viewPlatformTG.getTransform(VPTG_ghost_T3D_inverted); > viewPlatformTG.getTransform(VPTG_ghost_T3D_noninverted); > VPTG_ghost_T3D_inverted.setTranslation(new >Vector3d(0.0,0.0,0.0)); > VPTG_ghost_T3D_noninverted.setTranslation(new >Vector3d(0.0,0.0,0.0)); > > // Invert the Viewer's T3D so we can remove it from the >objects Transform > VPTG_ghost_T3D_inverted.invert(); > > // Multiply the inverted Viewer Ghost T3D to factor it out >of the objects Transform > //orbitT3D.mul(VPTG_ghost_T3D_inverted, orbitT3D); > tg_ghost_T3D.mul(VPTG_ghost_T3D_inverted, tg_ghost_T3D); > > tg_ghost_T3D.setTranslation(new Vector3d(0.0,0.0,0.0)); > > boolean invert = true; > > if (invert) > { > tg_ghost_T3D.mul(tg_ghost_T3D, orbitT3D); > } > else > { > tg_ghost_T3D.mul(orbitT3D, tg_ghost_T3D); > } > > // Multiply the noninverted Viewer Ghost T3D to factor it >back into the objects Transform > tg_ghost_T3D.mul(VPTG_ghost_T3D_noninverted, tg_ghost_T3D); > > tg_ghost_T3D.setTranslation(tg_ghost_vec3f); >// tg_ghost.setTransform(tg_ghost_T3D); // Needs to >accumulate for next drag > //tg.setTransform(tg_ghost_T3D); > > // Now do this for the viewer > > Transform3D VPTG_ghost_T3D; > VPTG_ghost_T3D = new Transform3D(); > viewPlatformTG.getTransform(VPTG_ghost_T3D); > Vector3f VPTG_ghost_vec3f = new Vector3f(); > VPTG_ghost_T3D.get(VPTG_ghost_vec3f); // Save the >VPTG_ghost_vec3f for later > > > Vector3f temp_vec3f = new Vector3f(); > temp_vec3f.x = VPTG_ghost_vec3f.x - tg_ghost_vec3f.x; > temp_vec3f.y = VPTG_ghost_vec3f.y - tg_ghost_vec3f.y; > temp_vec3f.z = VPTG_ghost_vec3f.z - tg_ghost_vec3f.z; > VPTG_ghost_T3D.setTranslation(temp_vec3f); > > VPTG_ghost_T3D.mul(VPTG_ghost_T3D_inverted, VPTG_ghost_T3D); > > if (invert) > { > VPTG_ghost_T3D.mul(VPTG_ghost_T3D, orbitT3D); > } > else > { > VPTG_ghost_T3D.mul(orbitT3D, VPTG_ghost_T3D); > } > > VPTG_ghost_T3D.mul(VPTG_ghost_T3D_noninverted, >VPTG_ghost_T3D); > > VPTG_ghost_T3D.get(temp_vec3f); > temp_vec3f.x = temp_vec3f.x + tg_ghost_vec3f.x; > temp_vec3f.y = temp_vec3f.y + tg_ghost_vec3f.y; > temp_vec3f.z = temp_vec3f.z + tg_ghost_vec3f.z; > VPTG_ghost_T3D.setTranslation(temp_vec3f); > > > viewPlatformTG.setTransform( VPTG_ghost_T3D ); > > } > > >But the view rotating behaviors in the same way as the >MouseRotate in J3D. What have I done wrong? According to >my testing it's also no difference with the following code. > > > private void calcTransformOrbit2() { > > double dy = yawAngleDelta; > double dx = pitchAngleDelta; > > Transform3D tempT3D = new Transform3D(); > Transform3D orbitT3D = new Transform3D(); > > tempT3D.setTranslation( new Vector3d( pickedPoint.x, pickedPoint.y, >pickedPoint.z ) ); > orbitT3D.mul(tempT3D); > > double y_factor = 1.0; > double x_factor = 1.0; > tempT3D.rotX(dx*x_factor); > orbitT3D.mul(tempT3D); > tempT3D.rotY(dy*y_factor); > orbitT3D.mul(tempT3D); > > Transform3D viewPlatformT3D = new Transform3D(); > viewPlatformTG.getTransform(viewPlatformT3D); > viewPlatformT3D.mul( orbitT3D ); > > currentVpT3D.set( viewPlatformT3D ); > > } > > >Any hints or any examples to do this will be appreciated. > >Thanks, > > >Bo > > > >------------------------------------------------------------- >myview technologies GmbH & Co. KG >Riemekestraße 160 ~ D-33106 Paderborn ~ Germany >E-Mail: mailto:[EMAIL PROTECTED] >Telefon: +49/5251/69090-351 ~ Fax: +49/5251/69090-399 >------------------------------------------------------------- > >=========================================================================== >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". *********************************************************************** Eric Reiss - http://www.sigda.acm.org/Eric/ Email: [EMAIL PROTECTED] SIGDA Internet Server Manager - http://www.sigda.acm.org/ Assistant Systems Manager - School of Engineering University of Pittsburgh *********************************************************************** =========================================================================== 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".