Post by Sebastian MesserschmidtHi Petr,
Post by Petr SvobodaHi,
I have a very weird problem.
I downloaded some models from Sketchup warehouse, exported as OBJ format and then converted using osgconv to OSG format.
Could you please provide an example?
Post by Petr SvobodaNow, when I use osgUtil::LineSegmentIntersector then on some models "there is" an intersection detected on others there is not. Why is that?
Is there a need of creating some bounding boxes or something like that? Or some osgconv bug? Model bug?
How are you using the IntersectionVisitor? Providing an example model
plus the code you are using would give us the means helping you.
cheers
Sebastian
Post by Petr SvobodaThank you!
Cheers,
Petr
------------------
http://forum.openscenegraph.org/viewtopic.php?p=58730#58730
_______________________________________________
osg-users mailing list
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
------------------
Post generated by Mail2Forum
In my scene there are objects:
Code:
osg::Node* m_tv = osgDB::readNodeFile( "external/models/television.osg" );
m_tv->setName("television");
if(!m_tv)
{
std::cout << "Error: Couldn't find model!" << std::endl;
}
osg::ref_ptr<MyObject> television = new TV(this);
television->insertChild(0,m_tv);
television->setName("television");
//MyObject is abstract and it's basically PositionAttitudeTransform
Then I'm looking for intersection with these objects/models
Code:
//some inits etc...
//basic idea is that some of these objects which I'm interested in have names as identifications getName("television") etc.. and I'm looking for them
osgUtil::LineSegmentIntersector::Intersections& intersections = ins->getIntersections();
if ( !ins->containsIntersections() ) return std::string("");
for ( it = intersections.begin() ; it != intersections.end(); ++it )
{
for ( path_it = it->nodePath.rbegin(); path_it != it->nodePath.rend(); ++path_it)
{
MyObject* temp = dynamic_cast<MyObject*>(*path_it);
if ( temp == 0 ) continue;
if ( (*path_it)->getName() != "" ) //if my objects "of interest" has a name
{
cdloc = it->getWorldIntersectPoint();
return (*path_it)->getName(); //returning identification (name) od object
}
}
}
All of objects in the scene are downloaded from SketchUp Warehouse to SketchUp application. Because of some "non compatible" format of models I export them from SketchUp application as OBJ files.
Then using osgconv to convert them to OSG files.
The interesting part is that when I use different object for television, so in code
Code:
osg::Node* m_tv = osgDB::readNodeFile( "external/models/radio_model.osg" );
instead of
osg::Node* m_tv = osgDB::readNodeFile( "external/models/television.osg" )
Then there is no Intersection collision detected or in other worlds
Code:
if ( (*path_it)->getName() != "" ) //if my objects "of interest" has a name
{
cdloc = it->getWorldIntersectPoint();
return (*path_it)->getName(); //returning identification (name) od object
}
else return "";
this piece of code wont ever return other string then "".
I tried like 5 models, all the same way -> downloaded from Sketchup, exported, converted, same code just different model.. Some of them worked (intersection collision returned their identification via getName() ) some of them not.
I hope I explained it clearly
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=58732#58732