segmentation fault in btMotionState

Post Reply
Manish Bista
Posts: 6
Joined: Wed Feb 11, 2015 2:04 am

segmentation fault in btMotionState

Post by Manish Bista »

Hello everyone, I have been getting segmentation fault errors in my code in the line where btMotionState is used. The purpose of the function is to render a plane. The function where the error is shown is given below:

Code: Select all

void rag::renderPlane(btRigidBody* plane, matrices& pipeline, unsigned int program)
{
	if(plane->getCollisionShape()->getShapeType()!=STATIC_PLANE_PROXYTYPE)
	return;
	glColor3f(0.8,0.8,0.8);
	btTransform t;
        btMotionState* motionState=plane->getMotionState();    //error here
	plane->getMotionState()->getWorldTransform(t);
	float mat[16];
	t.getOpenGLMatrix(mat);
	glm::mat4 phys = returnMatrixFromMembers(mat);        
	pipeline.pushMatrix();
	pipeline.updateMatrices(program);
		glBegin(GL_QUADS);
			glVertex3f(-1000,0,1000);
			glVertex3f(-1000,0,-1000);
			glVertex3f(1000,0,-1000);
			glVertex3f(1000,0,1000);
		glEnd();
	pipeline.popMatrix();
}
The code above was working fine when I used OpenGL with bullet physics. Then I needed to use assimp library to load models, so I needed to change the code, which later resulted in a segmentation fault. I commented out the part where motion state is used and any other parts relating it. Then, no errors were shown. What could be the possible cause of error? I read somewhere that if there are other libraries also using bullet physics, but of a different version, then errors are thrown at random places.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: segmentation fault in btMotionState

Post by Erwin Coumans »

It will require some debugging from your side, look at the call stack and check for uninitialized memory etc. It is not likely a bug in Bullet.
Post Reply