How to represent this arena in bullet?

Post Reply
peanutandchestnut
Posts: 8
Joined: Mon Feb 02, 2015 8:40 am

How to represent this arena in bullet?

Post by peanutandchestnut »

I have an arena which might look like this:

Image
I believe it's too expensive to use Triangle mesh.
I'm thinking to use static plane to represent floor,
and 64 box shapes to represent the wall.(every box for a section of wall).

I have never worked in this area, i don't know the usual solution for this kind of problem.
I also want to know how to represent a house, a room using bullet.
Pls help me if you have experience in ths area, an advice, an article or a book name.
Any help would be appreciated!
User avatar
drleviathan
Posts: 849
Joined: Tue Sep 30, 2014 6:03 pm
Location: San Francisco

Re: How to represent this arena in bullet?

Post by drleviathan »

Bullet could handle that arena no sweat using a btCompoundShape with a plane and many boxes. That is a good way to go forward.

Similarly a house or other complex model could collide cheaply in Bullet if it were a btCompoundShape of convex shapes. You'd have to compute the convex shapes somehow -- either manually through a modeling program or perhaps programatically using V-HACD.
Flix
Posts: 456
Joined: Tue Dec 25, 2007 1:06 pm

Re: How to represent this arena in bullet?

Post by Flix »

I believe it's too expensive to use Triangle mesh.
It that's a static wide geometry, I don't think it's too expensive at all: you can try and see :) .

However I agree that usually convex hulls behave better that btBvhTriangleMeshes: in that case you can use vhacd, as suggested by drleviathan, or just decompose the mesh manually, as you suggested (I would use as many convex hulls as necessary if the mesh is big).

As a possible optimization, if you use convex hulls and the mesh is static you can avoid packing the convex hulls inside a btCompoundShape: just add every single hull to the world as a static btRigidBody (if you need to save some memory you can probably use plain btCollisionObjects, but I suggest you start using btRigidBodies): according to some experiments I've made some year ago, that is slightly faster.
peanutandchestnut
Posts: 8
Joined: Mon Feb 02, 2015 8:40 am

Re: How to represent this arena in bullet?

Post by peanutandchestnut »

Thanks for your replay, drleviathan and Flix.
The V-HACD project looks great.
I'm going to use 64 boxshapes and a bottom shape, all rigidbody, no compound shape. .
The reason i believe trigngle mesh is expensive is that if i use it, the aabb of arena will intersect with every single aabb in this arena, bullet will test the arena with every dynamic rigid body in every step(i'm not 100% sure), the test includes every face in triangle mesh(i guess), that must be expensive. But i havn't tried it, i will give it a go when my scene is 100% ready.
Flix
Posts: 456
Joined: Tue Dec 25, 2007 1:06 pm

Re: How to represent this arena in bullet?

Post by Flix »

peanutandchestnut wrote:The reason i believe trigngle mesh is expensive is that if i use it, the aabb of arena will intersect with every single aabb in this arena, bullet will test the arena with every dynamic rigid body in every step(i'm not 100% sure), the test includes every face in triangle mesh(i guess), that must be expensive. But i havn't tried it, i will give it a go when my scene is 100% ready.
Yes, testing is the best thing you can do.

However, although I'm not an expert about the internals of the Bullet library, maybe there's an additional aabb test per triangle before performing the narrowphase collision detection: that's much faster.
AFAIK btBvhTriangleMeshShape means "bounding volume hierarchy": that should imply that there is some sort of hierarchical structure of aabbs.
Post Reply