Skip to main content

Shape at fixed view position

4 replies [Last post]
ostenl
Offline
Joined: 2004-11-06

Hi,
I would like to position a Shape3D object on a fixed position in the view. I.e. when the view is changed, rotated, translated or scaled the object shall always remain in the same position in the view. The object shall be pickable so I can't use overlay.

I update the transformation for the shape every time the view transform changes and I think I have all the tranformations sorted out correctly but I can't update the position without lag and flickering. The object moves a little and then jumps to the correct position again.
I have tried to implement it as a transform change behavior, put the update in Canvas3D.preRender and postRender and to update the shape TG at the same time as the view TG is updated but nothing of this has worked any better. There seems to be some delay between the view update and the scenegraph update.

Any suggestions on how to do this?

Regards,
OL

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
birinhos
Offline
Joined: 2006-02-17

if you have other cameras....:

camera1-have the object fixed
camera2-looking to camera1

camera2 will renderer the object fixed ??

if YES how do we make it not apear?

bayblade
Offline
Joined: 2006-02-17

The best technique to do this is to use a ViewingPlatform object assigned to your View and Universe. The technique to use ViewingPlatform will depend on the Universe type you're using. ViewingPlatform manages the Transform assigned to your View as well as acting as a BranchGroup to add additional geometry to.

If your Universe is a SimpleUniverse, all you need to call is universe.getViewingPlatform(), and then add your Nodes to the platform. As the platform (View) moves, so too will your Nodes.

If your Universe is a VirtualUniverse, you'll need to create and manage your own ViewingPlatform. After creation, you must assign both the Universe and the ViewPlatform from the view you're using to it via the viewingPlatform.setUniverse() and viewingPlatform.setViewPlatform() methods. (You can get ViewPlatform from your View). When you've got the ViewingPlatform set up, simply add your Nodes to that.

ostenl
Offline
Joined: 2004-11-06

Thanks, now it works much better.
And when you know how to do it, it is quite obvious...

> The best technique to do this is to use a
> ViewingPlatform object assigned to your View and
> Universe. The technique to use ViewingPlatform will
> depend on the Universe type you're using.
> ViewingPlatform manages the Transform assigned to
> o your View as well as acting as a BranchGroup to add
> additional geometry to.
>
> If your Universe is a SimpleUniverse, all you need to
> call is universe.getViewingPlatform(), and then add
> your Nodes to the platform. As the platform (View)
> moves, so too will your Nodes.
>
> If your Universe is a VirtualUniverse, you'll need to
> create and manage your own ViewingPlatform. After
> creation, you must assign both the Universe and the
> ViewPlatform from the view you're using to it via the
> viewingPlatform.setUniverse() and
> viewingPlatform.setViewPlatform() methods. (You can
> get ViewPlatform from your View). When you've got
> the ViewingPlatform set up, simply add your Nodes to
> that.

franck calzada
Offline
Joined: 2006-02-17

hi,

you can use Overlays from http://www.j3d.org/

I think you want an avatar object basically right? I had the same need for my game:

http://cazapool3d.sourceforge.net/cazapooljws/Pool.html

I use j3d package to create my avatar management.
Just create an overlay and add you avatar to it.

if you need src code example let me know

regards,
Franck