[osg-users] Using PolytopeIntersector from the root of the scene graph instead of camera

2010-01-26 Thread Julien-Charles Levesque
Hi,

I'm trying to use a PolytopeIntersector in my scene and so far I have succeeded 
but only by using the camera (i.e. mCamera-accept(PolyVisitor)) with a 
PolytopeIntersector built from x and y coordinates in window frame. However I 
would rather pass the visitor the root of my scene. I am doing this in a 
virtual reality project, and using the camera seems to complicate things a fair 
bit because we modify projection matrices and viewports a whole lot. 

For my LineSegmentIntersector I have used 3D points in model space, which 
worked fine when visiting the root of the scene. For the PolytopeIntersector I 
am unsure how to do this... Only examples I have found so far used either 
coordinates in projection space or coordinates in window space.

Now I have seen the CoordinateFrame MODEL or VIEW in the PolytopeIntersector 
constructor, but I am unsure as how to use it. I have seen that the Znear plane 
is fixed to 0 for MODEL and VIEW coordinate frames.. Does this mean that any 
object behind Z=0 could not be intersected?

I also have a bad feeling that building and using the PolytopeIntersector in 
MODEL and VIEW coordinate frames will make it just rectangular instead of 
pyramidal. 

To recapitulate : I am trying to build a polytpe intersector from one 3d point 
in model space (or world space) and it's orientation. I would prefer this 
polytope intersector to be independent from the cameras or viewports. I am 
stuck at this point. Am I assuming something wrong? Did I miss something that 
could make this simpler? Do you have any clue that could help me? Am I even 
making sense? :D 

Thank a lot,

Sincerely,
Julien-Charles

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=23242#23242





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] LineSegmentIntersector, IntersectionVisitor and children

2009-09-15 Thread Julien-Charles Levesque
Hi,

I am using LineSegmentIntersectors with IntersectionVisitor to do some ray 
casting in my architecture. Everything works fine to select and move objects. 
However I want to implement a drag-and-drop interaction, where I can move an 
object onto another and have something different happen. I want to obtain this 
object using the ray casting as well, so I cast a ray and check to get the 
first object in Intersections that is not my current object (which I saved in a 
member variable at the beginning of my drag-and-drop). 

It all works fine until I start interacting with parent/child objects. I have a 
sphere and a cube, the sphere is the parent of the cube. When I drag-and-drop 
my cube over black space, the IntersectionVisitor returns me the sphere (the 
parent) as the second object intersected even though there is nothing behind 
the cube at the place I dropped it. 

Now I believe this has something to do with the parent's bounding sphere 
including it's children and thus being counted as an intersection, but I'm not 
sure how I can deal with this kind of stuff. Then again, I could be mistaken.

I tried reading about bounding spheres in the reference guide and did not see 
much, neither could I get much information (or enough information ;) about 
IntersectionVisitors.. any help would be strongly appreciated !


Thanks in advance !

Sincerely,
Julien-Charles

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=17395#17395





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Preventing scale from being transmitted to children

2009-09-14 Thread Julien-Charles Levesque
Hi,

I'm currently working with PositionAttitudeTransform controlled objects in my 
environment. Some objects are clearly too big, some too small. So I set their 
scale using the setScale function. Problem is that this scale is transmitted 
automatically to children of the Transforms, and I do not want that. Sure I 
could apply the inverse of the scale factor to each children, but that doesn't 
seem like a clean solution to me.

I want my children to receive the position and orientation modifications, alas 
not the scale modifications. There must be a simple way to do this, right ?

Anyone has a clue?

Thanks in advance!

Cheers,
JC

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=17354#17354





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org