I'm hoping to set up a wiki and public svn over the next few weeks. The
library is fairly bare-bones at this point, and therefore subject to radical
sudden changes. I'll continue to develop and enhance it into the future.
Contributions from a community will be welcome.
   -Paul
 


  _____  

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Dusten
Sobotta
Sent: Friday, October 31, 2008 12:45 PM
To: OpenSceneGraph Users
Subject: Re: [osg-users] Computing bullet collision models from .3ds files


Thanks a lot; this has been incredibly useful.  What is the eta for the
first release of your library?  I've also solved a few problems with
integrating osg + bullet, and might be able to contribute a few things if
you're up to it.


On Fri, Oct 31, 2008 at 12:20 PM, Paul Martz <[EMAIL PROTECTED]> wrote:


Hi Dusten -- The short answer (probably) is that you should look at
osg::TriangleFunctor.

The longer answer:

I'm currently developing an open source library containing utilities for
integrating OSG with Bullet. Here is the code I use to create triangle
meshes. The code for ComputeTriMeshVisitor is attached.


btTriangleMeshShape* osgBullet::btTriMeshCollisionShapeFromOSG( osg::Node*
node )
{
 ComputeTriMeshVisitor visitor;
 node->accept( visitor );
 osg::Vec3Array* vertices = visitor.getTriMesh();
 if( vertices->size() < 3 )
 {
   osg::notify( osg::WARN ) << "osgBullet::btTriMeshCollisionShapeFromOSG,
no triangles found" << std::endl;
   return( NULL );
 }

 btTriangleMesh* mesh = new btTriangleMesh;
 for( size_t i = 0; i + 3 < vertices->size(); i += 3 )
 {
   osg::Vec3& p1 = ( *vertices )[ i ];
   osg::Vec3& p2 = ( *vertices )[ i + 1 ];
   osg::Vec3& p3 = ( *vertices )[ i + 2 ];
   mesh->addTriangle( btVector3( p1.x(), p1.y(), p1.z() ),
       btVector3( p2.x(), p2.y(), p2.z() ),
       btVector3( p3.x(), p3.y(), p3.z() ) );
 }

 btBvhTriangleMeshShape* meshShape = new btBvhTriangleMeshShape( mesh, true
);
 return( meshShape );
}


I hope this is helpful. I'll post more info here when I make this code
publically available.

Paul Martz
Skew Matrix Software LLC
http://www.skew-matrix.com
+1 303 859 9466

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




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

Reply via email to