Bullet 2.64 released: all-in-one demos, memory allocators

Open source Bullet Physics SDK release information
Post Reply
User avatar
Erwin Coumans
Site Admin
Posts: 4150
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Bullet 2.64 released: all-in-one demos, memory allocators

Post by Erwin Coumans » Fri Nov 02, 2007 3:03 am

Bullet 2.64 is released.

Main improvements are:

- added all-in-one demo framework using glui, allowing all demos to run within one executable (thanks Erin Catto)
- Allow user to pass in their own memory (stack and pool) allocators, through collisionConfiguration
- All memory allocations go through btAlignedAlloc/btAlignedFree. User can override this to verify memory leaks
- Fixed various memory leaks in SDK. Some demos still need memory cleanup (next versions)
- fix for one of the constructors of btHingeConstraint Thanks Marcus Hennix

Download: http://sourceforge.net/project/showfile ... _id=147573

Enjoy,
Erwin

Erin Catto
Posts: 324
Joined: Fri Jul 01, 2005 5:29 am
Location: Irvine
Contact:

Re: Bullet 2.64 released: all-in-one demos, memory allocators

Post by Erin Catto » Fri Nov 02, 2007 3:24 am

Looking good!

Here's a revision for Main.cpp to help with the aspect ratio:

Code: Select all

void Resize(int w, int h)
{
	width = w;
	height = h;

	GLUI_Master.get_viewport_area( &tx, &ty, &tw, &th );

	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	double ratio = (double)tw / (double)th;

	gluPerspective( 45.0, ratio, 10.0, 10000.0 );
	glViewport( tx, ty, tw, th );

	if (demo)
		demo->reshape(tw, th);
}

topcomer
Posts: 32
Joined: Thu Sep 21, 2006 1:53 pm
Location: sweden but italian

Re: Bullet 2.64 released: all-in-one demos, memory allocators

Post by topcomer » Fri Nov 16, 2007 9:35 am

I have a small test case in which collisions cease to work after a while. If you take a virgin version of Bullet (2.63 or later), inside movingConcaveDemo replace the functions shootTrimesh() and clientMoveAndDisplay()
with:

void ConcaveDemo::shootTrimesh(const btVector3& destination)
{
if (m_dynamicsWorld)
{
float mass = 0.f;
btTransform startTransform;
startTransform.setIdentity();
btVector3 camPos = getCameraPosition();
startTransform.setOrigin(camPos);

btRigidBody* body = this->localCreateRigidBody(mass, startTransform,m_trimeshShape);

// Make it kinematic
body->setCollisionFlags( body->getCollisionFlags() |
btCollisionObject::CF_KINEMATIC_OBJECT );
body->setActivationState(DISABLE_DEACTIVATION);

btVector3
linVel(destination[0]-camPos[0],destination[1]-camPos[1],destination[2]-camPos[2]);
linVel.normalize();
linVel*=m_ShootBoxInitialSpeed*0.25;

body->getWorldTransform().setOrigin(camPos);
body->getWorldTransform().setRotation(btQuaternion(0,0,0,1));
body->setLinearVelocity(linVel);
body->setAngularVelocity(btVector3(0,0,0));
}
}

void ConcaveDemo::clientMoveAndDisplay()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

float dt = float(m_clock.getTimeMicroseconds()) * 0.000001f;
m_clock.reset();
m_dynamicsWorld->stepSimulation(dt);

// Update geometry
for( int i = 0; i < NUM_VERTICES; i++ )
gVertices[3*i + 0] += .001;

// Input updated geometry
if( m_trimeshShape != NULL )
{
m_trimeshShape->postUpdate();
m_trimeshShape->updateBound();
}

renderme();

glFlush();
glutSwapBuffers();
}


you'll also need to declare m_trimeshShape as btGImpactMeshShape inside ConcaveDemo.h and
include:

#include "GIMPACT/Bullet/btGImpactShape.h"
#include "GIMPACT/Bullet/btGImpactCollisionAlgorithm.h"


Now use . to shoot 1 bunny and then right click to hit it, you'll see that collisions
work for a short time then the bunny is penetrated by blocks. Am I doing something wrong?

Thanks,
Alessio

topcomer
Posts: 32
Joined: Thu Sep 21, 2006 1:53 pm
Location: sweden but italian

Re: Bullet 2.64 released: all-in-one demos, memory allocators

Post by topcomer » Wed Nov 28, 2007 9:50 am

Just in case one has the same problem, the solution is to change line 44 in btGImpactShape.h from:

typedef btGImpactQuantizedBvh btGImpactBoxSet;

to:

typedef btGImpactBvh btGImpactBoxSet;

Post Reply