Having a node follow the view?

I’m trying to implement a simple skybox but I can seem to get to work. I need to have a node’s transform follow the view. I have tried to create a Backgound node put the shape inside it but that didn’t work it only rendered the box aligned to the world not the view. I also tried to make the node a child of a view node but that didn’t work because I assume Xith3d wil not render your current view. I’m new to Xith3d so I could be missing something simple. I could align the skybox node with the view every frame but that would be defating the whole idea behind a scenegraph :slight_smile:
Any ideas?

I didn’t understand the problem :-[ What did you mean by “I need to have a node’s transform follow the view”?

Have you had a look at the demos at xith.org? They might give some clues on how somethings get done.

Maybe clarify on the problem, because someone is bound to be able to help you :wink:

Basicly I’m want to create a skybox/skydome. I need to have a Shape3D linked to the view’s translation. This will have an effect of the Shape3D moving with the view. Another way to look at is to have a Shape3D always located in front of your view kinda like a weapon in a FPS.

Thanks

Figured it out. I just needed to create a node that implements NodeUpdater and adjust the TransformGroups translation to match the view. Here is the code for the NodeUpdater interface

        public boolean preRender( Transform3D viewTransform, Frustum frustum, Transform3D modelTransform,  long time) {                  
              Vector3f trans = new Vector3f();
              Transform3D transform = new Transform3D();                  

              viewTransform.getTranslation(trans);
              transform.setTranslation(trans);
              getTransformGroup().setTransform(transform);

              return true;
        }

I was trying to figure out something similar. I wanted my billboards to grow dynamically with respect to the camera’s distance. NodeUpdater seemed like a good choice except that the javadoc for it states:


Node updater interface is designed to allow special code to adjust a node's appearance if it is going to be rendered. This should *not* be used to adjust a transform since these methods are only called if the renderer has determined that the node is within view...

Which sounds as if you could perform your transform and end up with a node outside of view when it was already in view previous to the transform. I never found a good way to do the updates automatically with camera motion but if you did this without any problems, I may try it. Does anyone have a better solution they’d like to share?

Yeah, I saw the same thing in the docs. I figured the sky box was always in view since its used with terrain so, I figured it wouldn’t be a big deal. If you were using it to move a node around the world then it would be an issue.

The correct way I guess would be to update the skybox’s transform group every frame in the renderOnce() loop.

I could potentially update my billboards in the main rendering loop but I’d have to open all sorts of holes in my classes to allow for that, which is why I haven’t done it. I guess if I set my billboards at the small end of the scale and then scale them up, there’s no chance that they would go out of view. I’m gonna try it.