I'm having a problem with a btSliderConstraint locking an object at one end of the linear constraint, so that it cannot slide back again. We have tried moving the rigid body either with impulses or by directly setting the velocity but it still gets stuck. Investigation into the solveConstraintInt() method found it was producing an impulse which was holding the body at the end of the constraint. I was able to modify this method to check against the relative velocity and depth, which stopped it getting stuck.
Is it possible to move a constrained body like this with a velocity or impulse? Or should we be using the motor functionality built into the slider?
btSliderConstraint locking
-
- Posts: 56
- Joined: Sat Mar 08, 2008 12:37 am
Re: btSliderConstraint locking
Hello,
Collision with other bodies works and could move body if it is at limit
I'll check to apply impulse.
For now you can use motor - this should work
Thanks,
Roman
Collision with other bodies works and could move body if it is at limit
I'll check to apply impulse.
For now you can use motor - this should work
Thanks,
Roman
-
- Posts: 2
- Joined: Tue Nov 25, 2008 3:13 pm
Re: btSliderConstraint locking
Hi
I am having a similar problem in Bullet 2.72. I have 2 rigid bodies connected by a slider joint, but the joint gets stuck when the ensemble(bodies + joint) is in mid-air at one of the limits. I am looking to modify the solveConstraintInt code for the slider joint in the way suggested previously and was wondering if there was any source code for comparison or if this has been included in 2.73?
Thanks.
I am having a similar problem in Bullet 2.72. I have 2 rigid bodies connected by a slider joint, but the joint gets stuck when the ensemble(bodies + joint) is in mid-air at one of the limits. I am looking to modify the solveConstraintInt code for the slider joint in the way suggested previously and was wondering if there was any source code for comparison or if this has been included in 2.73?
Thanks.
-
- Posts: 2
- Joined: Tue Nov 25, 2008 3:13 pm
Re: btSliderConstraint locking
I tried inserting the following code which seems to help a bit though it doesn't solve my original problem. There seems to be a lack of symmetry between the way the system is treated depending on which of the 2 bodies has forces applied to it Grateful for any ideas
//.. previous code
btScalar normalImpulse = softness * (restitution * depth / m_timeStep - damping * rel_vel) * m_jacLinDiagABInv;
// new code
if(i == 0)
{
if((rel_vel < 0.0f) && (m_linPos >= m_upperLinLimit))
{
if(normalImpulse < 0.0f)
{
normalImpulse = -normalImpulse;
}
}
if((rel_vel > 0.0f) && (m_linPos <= m_lowerLinLimit))
{
if(normalImpulse > 0.0f)
{
normalImpulse = -normalImpulse;
}
}
}
// previous code
btVector3 impulse_vector = normal * normalImpulse;
//.. previous code
btScalar normalImpulse = softness * (restitution * depth / m_timeStep - damping * rel_vel) * m_jacLinDiagABInv;
// new code
if(i == 0)
{
if((rel_vel < 0.0f) && (m_linPos >= m_upperLinLimit))
{
if(normalImpulse < 0.0f)
{
normalImpulse = -normalImpulse;
}
}
if((rel_vel > 0.0f) && (m_linPos <= m_lowerLinLimit))
{
if(normalImpulse > 0.0f)
{
normalImpulse = -normalImpulse;
}
}
}
// previous code
btVector3 impulse_vector = normal * normalImpulse;