View-Transform using TransformGroup

Hi all!

I added my View to another TransformGroup and wanted to apply this way an additional view-transform beside the Transform already set in the View. In Java3D you could do this (ok, not View but ViewPlatform). Is this not intended to be done or any other reasons why it doesn’t work???

I think a solution could be to not add the View to that TransformGroup but to add the whole scene instead and invert the transform, but the first way seems for me more intuitive.

Thanx alot,
hasait

I believe someone from JProof was working on implementing the ViewPlatform node. I’m not sure how far they got.

Will.

nothing useful found… :frowning:

ok, i looked into the Xith3D-code before implementing it by myself…
the easiest way would be to update the View’s transform with the ViewPlatform’s localToVWorld-transform when its updateLocalToVworld() is called. But there is one big problem with this clean solution: Node.updateLocalToVworld() is final.
I think the final should be removed OR another “if (this instanceof ViewPlatform) {…}” added. I think removing the final is much cleaner solution because “if (this instanceof TransformGroup)” and "if (this … Group) are not really OO, because the code inside the if-body should be moved into TransformGroup.updateLocalToVworld and Group.updateLocalToVworld…
Removing the final would give us a 20 lines long ViewPlatform achieving some more Java3d-compatibility…

What about it?


package core.xith3d;

import com.xith3d.scenegraph.BranchGroup;
import com.xith3d.scenegraph.View;

public class ViewPlatform extends BranchGroup {
   private final View _view;

   public ViewPlatform(final View pView) {
      super();
      _view = pView;
   }

   protected void updateLocalToVworld() {
      super.updateLocalToVworld();
      _view.setTransform(getLocalToVworld());
   }
}

i’ve come across this issue – usually what i do is setTransform the view-transform to the group I want it to follow, every time it needs to be updated…
essentially i have a UserCamera actor and the view, the user can control the UserCamera actor (it can collide with walls, etc) and the view just sets itself to it.