Replies: 5 comments 5 replies
-
What you've created with the example code is this: The constraint enforces the local space mPoint1 and mPoint2 to coincide in world space. It also enforces that the green axis align in world space. If the red axis align in world space we have In your example, as soon as the simulation starts, the bodies move together so that their COM's coincide (because both points were set to 0): and then they can rotate like this (the shared green axis): |
Beta Was this translation helpful? Give feedback.
-
Thanks for clarifying. This is indeed the behavior I have observed. I guess the confusion came from HingeConstraintSettings when defined in world space. In that case the really only meaningful way to "fill out" that struct is to set point and axis to the same values, like in all examples. I thought you could define two relative rotational degrees of freedom with this single constraint. Like a wheel that rotates but also can "squat" sideways, like some cars when accelerating. |
Beta Was this translation helpful? Give feedback.
-
You would use 2 different points/axis if two bodies were created in world space in a different relative orientation than how you would want them constrained. But it is indeed most useful if you specify them in local space.
That's not possible. You'd need a 6DOF constraint for that. |
Beta Was this translation helpful? Give feedback.
-
@jrouwe - btw... I noticed a potential contradiction in the comments of HingeContraintSettings... Experimentally, the limits indeed ignore what normal axis I specify and leaves the 0 angle at the initial state. |
Beta Was this translation helpful? Give feedback.
-
Ah so basically the normal axis on both bodies are where relative to the body the 0 angle is. Of course! It got really confusing while making custom visualizations. Btw, it might make sense to expose some getters for the private members of the relative positions so that the code in the debug draw members can be more easily replicated from the "outside". |
Beta Was this translation helpful? Give feedback.
-
The hinge constraint seems to work well, but only when mPoint1=mPoint2 and mAxis1=mAxis2, etc...
Possibly this is a confusion on my end, but I would think the behavior with regards to these settings should be equivalent to the DistanceConstraint.
Here is one way to reproduce the (for me) odd behavior:
From the sample app:
To keep it simple and remove the world to COM space transformations, the idea is that we leave everything to default, except setting the space. Now the two cubes will have their COM as the hinge frame origin, one cube dim from each other.
When the simulation starts the dynamic cube assumes the position of the other cube as if this was a distance constraint with min and max distance 0.0. One would expect the initial distance between mPoint1 and mPoint2 being retained.
Similar issues (but more confusing) seem to happen with multiple axes.
Beta Was this translation helpful? Give feedback.
All reactions