Limits/Servo and CurrentAngle for BallSocketConstraints

Continuing the discussion from What are you working on currently?:

It came up in discussion that there wasn’t really a good way to have branches of a tree compress when the tree fell. HingeConstraints can already accomplish a similar effect with a server actuator:

But hinges don’t work quite well for tree branches since they can only be pushed in one direction. BallSocketConstraints are more appropriate for tree branches that can bend in any direction. Unfortunately, BallSocketConstraints don’t have any sort actuator functionality, so we can’t make the constraint “stiff” so to speak. With a servo actuator though, we could link up the branches of the tree with BallSocketConstraints, have them stay stiff, but upon being pushed enough give way.

Use cases:

  • Tree branches bending when a tree topples over
  • Foliage collapses as you drive over it but pops back up when you drive off like in Arma
  • Apply occasional thrust to nearby tree branches to produce the effect of the trees swaying in the wind
  • An antenna on a vehicle that can be pushed in any direction but pops back to straight afterwards
  • Training dummy that pops back into place after being hit
  • Fishing rod bending and snapping back into place when force is removed

We would need some sort of min/max/target angle properties like we have on HingeConstraint, but they would have to be a Vector2 or Vector3 (if BallSockets allow rotation around Y axis) as opposed to a single number. It’d also be useful to have a CurrentAngle property so we could do cool stuff like have objects permanently snap (but remain attached – current BallSocket behavior) once they reach a certain angle threshold or even break off completely.

3 Likes

I agree these would be useful features to have on a ball socket constraint. Universal Joint will be another (future) constraint that will help in building branches (or antennas). At some point we will definitely add torsion springs which then can be used to simulate bending of branches.

1 Like

At this point you can do simple branches using hinges and springs. Servos are not appropriate as they lock in target position (although you can set the angular limit on a hinge to be smaller than the target angle, and the servo will never lock). Servo locking means that after it reaches its target, it will take a very high force to move - it simulate a pin being inserted in the mechanism when it’s in stable position.

BTW you can now use AlignOrientation in tandem with BallSocket:

2 Likes