Hi,
I think there is a bug in applying forces stored in contact points when I connect two bodies with a joint, see the attached reproduction case.
There is one box on the top of the other. When you press the 'e' key, they get connected by a constraint, see the activateJoint method.
When you press 'e' again, they get disconnected and a torque is applied on the top body for one physics step.
When you press 'e' three times quickly at the beginning, the top body maintains rotating.
The first 'e' connects the bodies. The second 'e' disconnects them, makes the top body to rotate and fills the contact points with some force values. The third 'e' connects the bodies again, but the top body keeps rotating, although it should stop.
I think the forces in contact points are still applied.
Can you take a look at it? I am not sure how to fix it myself.
Thanks.
Regards, Jiri
manifold points and constraints
-
- Posts: 3
- Joined: Thu Aug 23, 2012 10:45 pm
manifold points and constraints
You do not have the required permissions to view the files attached to this post.
-
- Posts: 43
- Joined: Sat May 26, 2012 1:09 am
Re: manifold points and constraints
The top body does not stop rotating as the hinge constraint's axis points
through the y/up axis. That is, it is unlikely to be related to contact forces.
The hinge constraint in the attachment is probably configured similarly to
the diagram below, except that the axis is through the center of the rigid bodies.
You can control the rotational velocity along the axis by using
btHingeConstraint::enableAngularMotor(); see
http://www.continuousphysics.com/Bullet ... 3f6a304c28
through the y/up axis. That is, it is unlikely to be related to contact forces.
The hinge constraint in the attachment is probably configured similarly to
the diagram below, except that the axis is through the center of the rigid bodies.
Code: Select all
----------
| |===|
| Body 1 | |
| |===|
---------- |
| <-- Hinge axis
---------- |
| |===|
| Body 0 | |
| |===|
----------
btHingeConstraint::enableAngularMotor(); see
http://www.continuousphysics.com/Bullet ... 3f6a304c28
-
- Posts: 3
- Joined: Thu Aug 23, 2012 10:45 pm
Re: manifold points and constraints
Thanks for reply.
The y-axis is intentional. The top body sits on the lower body due to gravity, so there must be contacts. And the contact forces should come from friction, because there was the impulse given.
I agree with your scheme, it is intentional.
I do not want the bodies to rotate. I want them to stop after the initial impulse.
The y-axis is intentional. The top body sits on the lower body due to gravity, so there must be contacts. And the contact forces should come from friction, because there was the impulse given.
I agree with your scheme, it is intentional.
I do not want the bodies to rotate. I want them to stop after the initial impulse.
-
- Posts: 43
- Joined: Sat May 26, 2012 1:09 am
Re: manifold points and constraints
I think what's happening is that the constraint is set so that the
rigid bodies are just barely separating(so friction forces are not applied).
If the constraint's localA/localB position is changed from ±1.0 to ±0.99,
or 'e' is pressed only twice(so that the constraint is not active, and
does not create a gap between the rigid bodies), the bodies eventually
stop rotating.
If you want to stop the bodies from rotating while the constraint is
active, the best option would probably be to use enableAngularMotor()
with a target velocity of 0.
rigid bodies are just barely separating(so friction forces are not applied).
If the constraint's localA/localB position is changed from ±1.0 to ±0.99,
or 'e' is pressed only twice(so that the constraint is not active, and
does not create a gap between the rigid bodies), the bodies eventually
stop rotating.
If you want to stop the bodies from rotating while the constraint is
active, the best option would probably be to use enableAngularMotor()
with a target velocity of 0.