Picking isn't detecting my TransformGroup being rotated

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Picking isn't detecting my TransformGroup being rotated

unixnerd
I have a scene with lots of shape3Ds such as cylinders. They are each inside their own TransformGroup to give them position and orientation. Picking works just fine with this so long as I call getLocalToVworld() to give me absolute x,y,z values within the scene.

If I rotate the scene with the mouse all is fine.

The problem is that if I rotate the scene programmatically picking still thinks the shapes are in the old locations despite everything looking fine on screen. How do I fix this?

Thanks for the help.

The docs https://docs.oracle.com/cd/E17802_01/j2se/javase/technologies/desktop/java3d/forDevelopers/j3dguide/SceneGraphOverview.doc.html mention two forms of getLocalToVworld which take arguments and talk about nodes which are / aren't part of a shared subgraph being different but I don't get it. All my items have one common parent which I'm rotating.
Reply | Threaded
Open this post in threaded view
|

Re: Picking isn't detecting my TransformGroup being rotated

philjord
Hi,
Would it be possible to try and get a simple test case of code together.

It would be good to see what MouseRotate you are using and how the programmatic scene rotation occurs.

Thanks,
Phil.
Reply | Threaded
Open this post in threaded view
|

Re: Picking isn't detecting my TransformGroup being rotated

unixnerd
It's a pretty huge bit of software alas. Everything is under the "tg" TransformGroup. I rotate with:
       
Transform3D sceneTrans = new Transform3D();
tg.getTransform(sceneTrans);

Transform3D zRot = new Transform3D();
zRot.rotZ(angle);
sceneTrans.mul(zRot);

tg.setTransform(sceneTrans);

I'm not doing anything with MouseRotate. Thanks for the help :-)
Reply | Threaded
Open this post in threaded view
|

Re: Picking isn't detecting my TransformGroup being rotated

gouessej
Administrator
I agree with Phil, providing a small reproducer would be a good exercise to isolate the problem.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Picking isn't detecting my TransformGroup being rotated

unixnerd
I totally get your point. But I suspect even greatly cut down it'd be a bit much to expect other folk to read through. I'll see what I can do.....

For now I'm keeping a track of the accumulated angle it's programmatically rotated and applying a transform to reverse it when I get the picking result. As the model is centred on zero this works.
Reply | Threaded
Open this post in threaded view
|

Re: Picking isn't detecting my TransformGroup being rotated

gouessej
Administrator
If it's really too hard, maybe starting from scratch on a rudimentary example will be easier.
Julien Gouesse | Personal blog | Website