Constraint performance problem

dave2k
Posts: 1
Joined: Fri Jun 18, 2010 12:03 pm

Constraint performance problem

Post by dave2k »

Hi

I am using bullet on the iPhone.

I coded a lift object which needs to just go up and down.

It works but it is very CPU hungry, resulting in a very low framerate. My code is below. I tracked down the performance issue to be with the setAngularLimit functions. Is there any way to replace these given i want something so simple as a lift?

Code: Select all

	btGeneric6DofConstraint* slider;
	btTransform frameInA = btTransform::getIdentity();
	frameInA.setOrigin(btVector3(btScalar(0), btScalar(0), btScalar(6.125)));
	btTransform frameInB = btTransform::getIdentity();
	frameInB.setOrigin(btVector3(btScalar(0), btScalar(0), btScalar(0)));
	slider =  new btGeneric6DofConstraint( *cylinder2->_SIO2objectphysic->_btRigidBody, *cylinder3->_SIO2objectphysic->_btRigidBody,
										 frameInA, frameInB, true );
	slider->setLinearLowerLimit(btVector3(0,0,0));
	slider->setLinearUpperLimit(btVector3(0,0,100));
	slider->setAngularLowerLimit(btVector3(0,0,0));
	slider->setAngularUpperLimit(btVector3(0,0,0));
	_MWlevel->_SIO2physic->_btSoftRigidDynamicsWorld->addConstraint(slider, true);
thanks

david
B_old
Posts: 79
Joined: Tue Sep 26, 2006 1:10 pm

Re: Constraint performance problem

Post by B_old »

I don't know the details of your project, but have you considered making the lift out of a kinematic rigidbody and animate it yourself?