Bullet addConstraint crashing Python

filmore

05-06-2011 14:07:05

I'm trying to add a point2point constraint to an object during simulation, but it causes a crash. My code creates a constraint whenever the object comes in contact with another object at the point of contact.


constraint = bullet.btPoint2PointConstraint(self.object.rb.mRigidBody,ptA)
self.dynamicsWorld.addConstraint(constraint) # Causes Crash


I get this error:

Microsoft Visual C++ Runtime Library

Runtime Error!
Program: C:\Python27\pythonw.exe
R6025
- pure virtual function call

dermont

05-06-2011 15:36:05

It looks like you need to keep a reference to your constraint object, e:g:


self.constraint = constraint
## OR
self.constraintList = []
.....
self.constraintList.append(constraint)

filmore

07-06-2011 00:51:21

Creating a self reference didn't work, but the list did the trick. Is there any particular reason for this?

Thanks again