affine transforms relative to screen

I am not entirely sure what I’m doing wrong, and maybe some of you guys with experience can quickly point that out for me.

For ex: currently, I can move objects on a scene by dragging them. I can specify which axis to act upon, and by intercepting mouse drag events, I do something like:


public static void move(float dy, float dx, boolean X, boolean Y, boolean Z) {
            if(!isObjectSelected) return;

Transform3D move = new Transform3D();
            
            Vector3f v = new Vector3f();
            v.x=v.y=v.z=0;
            
        float x = dx * mov_adjustment;
        float y = dy * mov_adjustment;        
        
        
            if(X)
             v.x += -x;
      
            if(Y)
              v.y += -y;                                    
                        
            if(Z)
                v.z += x;                  
                        
            move.set(v);
            
            TransformGroup tg = controlObject.getTransformGroup();            
            Transform3D t3d = tg.getTransform();
            
            move.mul(t3d);            
            tg.setTransform(move);
}

Every object has a TransformGroup attached to each in order to perform these transformations. That’s the way I found to be able to manipulate individual nodes, and still not sure if there’re better ones.

My problem is that if I change where my View is looking at (by rotating the view for example) the movement of the object is not very intuitive. That is, if the view is rotated 90o, moving the mouse along the screen’s x-axis will still increase the object.x location so that it moves along the screen’s y-axis. What do people do normally in this situation where a more intutive approach is preferable?

Somehow, I wanted to take into account the View’s Transform… any ideas on how I could accomplish that?

thanks.
Pedro