jointValue method

  1. @override
double jointValue(
  1. int joint
)
override

A hinge's angle (radians) or a slider's position (metres) — body A's, measured from body B (or the world) — the same quantity a position motor drives; 0 for other joints.

Implementation

@override
double jointValue(int joint) {
  final j = joints[joint];
  final measured =
      j != null &&
      (j.settings.kind == JointKind3D.hinge ||
          j.settings.kind == JointKind3D.slider);
  return measured && j.motorState == MotorState3D.position
      ? j.motorTarget
      : 0;
}