-
johnsonalpha
- Posts: 73
- Joined: Fri May 01, 2015 8:23 pm
Post
by johnsonalpha »
if i do this
Code: Select all
p2p =newbtPoint2PointConstraint(body1,body2.b1trans,b2trans);
how can i delete this now
-
IresomPCH
- Posts: 18
- Joined: Tue Sep 24, 2013 12:29 pm
Post
by IresomPCH »
If you already add the constraint to the dynamic world, then you can use:
world->removeConstraint(yourConstraint);
-
johnsonalpha
- Posts: 73
- Joined: Fri May 01, 2015 8:23 pm
Post
by johnsonalpha »
Is there a way to loop through all joints and delete them?
-
xexuxjy
- Posts: 225
- Joined: Wed Jan 07, 2009 11:43 am
- Location: London
Post
by xexuxjy »
Not directly, though it would be easy enough to add such a method to btDiscreteDynamicsWorld, or to expose it's constraints list if you wanted to :
btDiscreteDynamicsWorld.h
btAlignedObjectArray<btTypedConstraint*> m_constraints;
-
johnsonalpha
- Posts: 73
- Joined: Fri May 01, 2015 8:23 pm
Post
by johnsonalpha »
can you help me how would i write that im really stupid
-
johnsonalpha
- Posts: 73
- Joined: Fri May 01, 2015 8:23 pm
Post
by johnsonalpha »
is it like this btAlignedObjectArray p2p* m_constraints;
-
anthrax11
- Posts: 72
- Joined: Wed Feb 24, 2010 9:49 pm
Post
by anthrax11 »
btDynamicsWorld has getConstraint:
Code: Select all
for(int i=0; i < world->getNumConstraints(); i++)
{
btTypedConstraint* constraint = world->getConstraint(i);
...
}
To remove all constraints:
Code: Select all
for (int i=m_dynamicsWorld->getNumConstraints()-1; i>=0; i--)
{
btTypedConstraint* constraint = world->getConstraint(i);
world->removeConstraint(constraint);
delete constraint;
}