0

By default, the BulletGenericConstraint in Panda3D is oriented along positive X axis. The setAngularLimit method can be used to set only along X, Y or Z axis. How do I join two bodies which do not lie orthogonal to any of the axis by a BulletGenericConstraint?

That is, how do I orient a BulletGenericConstraint in a direction along an arbitrary vector, which is not along X, Y or Z axis?

Ashwin Nanjappa
  • 76,204
  • 83
  • 211
  • 292

1 Answers1

0

BulletGenericConstraint takes two 'frame' arguments, each being a TransformState object. I believe you can use these to specify a relative rotation between the two bodies being affected by the constraint.

The TransformState interface is a bit tricky to work with, but it's easy to use once you get the hang of it. Transform states use a special kind of cache that causes them to be immutable. Every setX operation you perform on it does not modify the object, but instead returns a new TransformState object with the requested operation applied.

It is perhaps easiest to use a TransformState object that has already been applied on a node, using getTransform(), getNetTransform(), or getTransform(otherNode). Or, you can construct a TransformState object from a translation and a set of HPR angles:

ts = TransformState.makePosHpr(pos, hpr)
rdb
  • 1,488
  • 1
  • 14
  • 24