Open GoogleCodeExporter opened 8 years ago
The latest trunk has the option to create btBvhTriangleMeshShape (named
BvhMesh), and it won't embed this in a btCompoundShape. This should deal with
(2) and (3).
I didn't fix (1) yet.
Original comment by erwin.coumans
on 12 Mar 2011 at 6:03
Issue 15 has been merged into this issue.
Original comment by erwin.coumans
on 12 Mar 2011 at 6:19
Good to hear!
Would it be possible to have the btBvhTriangleMeshShapes converted to
btOptimizedBvhs during the export process? Would there ever be a scenario where
we wouldn't want them to be Optimized once saved to disk? Its simple enough to
convert them to optimized inside the WorldImporter on load but then a build
step is required to move the optimization stage out of a run time game load.
Original comment by cont...@vicariousentertainment.com
on 15 Mar 2011 at 12:04
So I was playing around with this stuff in the new 2.78 release a little in
hopes that OptimizedBVHs would solve some of my collision problems in my game
and I've learned a few things.
First off ignore my previous comment, the change you did does create
OptimizedBVHs. However the new BVH Shape Type feature in Dynamica didn't quite
make it into 2.78. In collisionShapeNode.cpp of the Dynamica project, the index
for the BVH option was incorrect...
fnEnumAttr.addField("Plane", 6);
fnEnumAttr.addField("BvhMesh", 6); <-- Line 71 in collisionShapeNode::initialize()
fnEnumAttr.setKeyable(true);
After much pain I managed to get the Dynamica project to compile (never used
cmake before and the 2008 .net project file it generated was missing some libs
and such), and changed that 6 to a 7 and now type BVHs are accessable in Maya
and work! This has actually been fixed in the latest trunk as someone has added
another new Shape Type after it and noticed the error. However, once you've
created Optimized BVHs in a scene in Maya, Maya will crash when you close the
file down (doesn't corrupt the file at least).
Next I had to modfiy btWorldImporter to get the saved OptimizedBVHs to be used.
I simply had to undef some defined out code in
btBulletWorldImporter::convertCollisionShape, line 565..
btOptimizedBvh* bvh = 0;
#if 0
if (trimesh->m_quantizedFloatBvh)
{
btOptimizedBvh** bvhPtr = m_bvhMap.find(trimesh->m_quantizedFloatBvh);
if (bvhPtr && *bvhPtr)
{
bvh = *bvhPtr;
} else
{
bvh = createOptimizedBvh();
bvh->deSerializeFloat(*trimesh->m_quantizedFloatBvh);
}
}
... etc.
Changing the define got that working fine and I've noticed no problems with
this code in effect. Deallocation and all is good, not sure why it was defined
out in the first place.
So to get back to the original Issues, #2 is fixed if you change the Shape type
manually, and no CompoundShape is generated in that case. However I would say
#3 is still an issue as every other Shape Type is still in a btCompoundShape
even when there is only one shape.
Having #1 implimented somehow would be great too. btWorldImporter isn't setup
to handle pure btCollisionObjects without accompaning btRigidBodies as is but
its a fairly simple conversion. I've done it myself locally and I could submit
a patch for that if you like.
Thanks alot for the OptimizedBVHs feature though, nice to have them in game now!
Original comment by cont...@vicariousentertainment.com
on 13 Sep 2011 at 3:42
As requested I've attached the SVN patch file for the modification to
btWorldImporter to allow it to load, store and access btCollisionObjects
without having Rigid Bodies attached. If issue 1 above does get implimented
these changes would be necesary. Though you may disagree with one direction I
took. It appears the WorldImporter was originaly written with the intention of
all types of bodies (rigid, soft & plain CollisionObjects) be stored in a
single list but the access functions are named just for RigidBodies. I
seperated the btCollisionObjects into their own lists and gave them their own
access functions and changed the type of the RB lists to btRigidBody as I felt
it would be simpler, clearer and closer to the original intent? But its
certainly possible for them to all be in one list still if desired.
Original comment by cont...@vicariousentertainment.com
on 13 Sep 2011 at 10:27
Attachments:
[deleted comment]
So as it looks like a new version of Bullet is coming out soon, now would be a
great time to fix up the remaining problems with the OptimizedBVHs coming out
of Maya.
1. That Defined out code I highlighed two posts above is still defined out and
you will not get any OptimizedBVHs from .bullet files working at runtime unless
you enable it.
2. The crash I mentioned is still in 2.80 Dynamica and is a real problem.
Setting any static mesh in Maya to OpimizedBVH will result in a crash when you
close that scene in Maya down (load another file, select new file or just try
to exit). We run out of the box Dynamica 2.80 for Maya 2010 64bit, and I belive
I originally ran into that issue in a 32bit build. Would you like me to create
a seperate issue for this crash?
Original comment by cont...@vicariousentertainment.com
on 11 Sep 2012 at 4:21
Well scratch number 2, I added an issue for that previously apparently and its
now been fixed (issue #24)! Thanks Erwin!
Original comment by cont...@vicariousentertainment.com
on 12 Sep 2012 at 12:49
That code is enabled now:
https://code.google.com/p/bullet/source/browse/trunk/Extras/Serialize/BulletWorl
dImporter/btWorldImporter.cpp#376
Original comment by erwin.coumans
on 25 Oct 2012 at 3:38
Yep! Just got 2.81 intergrated and we're back to running out of the box
btBulletWorldImporter. #1 in my original post is the only outstanding issue
left in this thread. The patch I submitted in Comment 5 may be of some use if
raw btCollisionObjects are ever exported straight out of Dynamica.
Original comment by cont...@vicariousentertainment.com
on 30 Oct 2012 at 3:48
Original issue reported on code.google.com by
cont...@vicariousentertainment.com
on 15 Feb 2011 at 2:35