Hello,

After spending several years writing plain OpenGL, I decided to seek it a bit 
higher, ending up with OSG. So I am currently working on my first project with 
OSG and I like. However, I have two questions that, after searching this forum 
and the web site, are not resolved yet.

1. My current project is developing a cloth simulation and it is working. The 
model consists of particles connected with springs. To visualize everything I 
use a Geometry object representing a triangle mesh, which I update every time 
step by first calling the dirtyDisplayList() function. This is not a very clean 
solution, but OSG is rather big and not everything has been documented,  so 
perhaps one of you know where I should be looking for a cleaner solution. There 
is osgParticle and osgAnimation, though I get the impression that osgParticle 
has been designed for unconnected particles.

2. I want to select particles with the mouse using a pick operation and this is 
working now for all objects in the scene. I only need to pick the cloth's 
particles, but how do I let OSG only do intersection tests on the cloth's 
geometry? Current implementation is now:


Code:

ref_ptr<LineSegmentIntersector> intersector = new 
LineSegmentIntersector(Intersector::PROJECTION, x, y);
    IntersectionVisitor intersectionVisitor(intersector);
    viewer->getCamera()->accept(intersectionVisitor);

    //Get the intersected triangle
    if (intersector->containsIntersections()) {
        LineSegmentIntersector::Intersection intersection = 
intersector->getFirstIntersection();
        const LineSegmentIntersector::Intersection::IndexList& indexList = 
intersection.indexList;
        unsigned int triangle[3];
        for (unsigned int j = 0; j < 3; ++j)
            triangle[j] = indexList[j];
        //Add picked particle to selection
        clothSelector->selectNearestParticle(triangle, 
intersection.getWorldIntersectPoint());
    }




I hope you guys can help me out with these two issues.[/code]

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





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to