Hello.
I was wondering if you could help me spot the error(s) with the code
below. The code is supposed to check if the palm of the hand is
intersecting a tool, and then return true if it is so that i can attach it
to the hand. Very crude right now. I think I know what the error is (local
coords), but I am unsure how to fix it. I suppose I have to give in to
accept() a parent node that they both share, and then distinguish the hits
more than just checking if there are hits.
Maybe I missed it, but is there a method to check if two objects are
intersecting? Like for bb's but works on a lower scale? Would make life
much easier :)
Best regards
Henrik Gundersen
osgUtil::IntersectVisitor iv;
osg::ref_ptr<osg::LineSegment> line = new
osg::LineSegment(mat_old.getTrans(), mat_new.getTrans());
iv.addLineSegment(line.get());
tool->accept(iv);
palm->accept(iv);
if(iv.hits()){
osgUtil::IntersectVisitor::HitList& hits = iv.getHitList(line.get());
if(!hits.empty())
{
//the two nodes are touching
return true;
}
}
Robert Osfield wrote:
> On 8/8/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>> I was wondering if there are any collision detection libraries that have
>> been sucessfully used with OSG?
>> If I had a better understanding of OSG I could probably just take a lib
>> and make a wrapper/converter, but as it is, I don't know anything (like
>> how to access down to polygon level of nodes, which i'm not completely
>> sure if even possible).
>
> I leave to others to commend on collision detection library
> integation. I can say lots of people have integrated the OSG with
> physics engines of different sorts.
>
> As for polygon access, sure its pretty easy, the OSG's own
> IntersectVisitor is a good example, why not have a look the source for
> to see how one can do.
>
> Robert.
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://openscenegraph.net/mailman/listinfo/osg-users
> http://www.openscenegraph.org/
>
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/