effectivePitch property

double get effectivePitch

Effective pitch angle of the boom.

Implementation

double get effectivePitch {
  if (!inheritPitch || !isAttached) return pitch;
  final ownerRot = vm.Quaternion.identity();
  node.globalTransform.decompose(
    vm.Vector3.zero(),
    ownerRot,
    vm.Vector3.zero(),
  );
  final qx = ownerRot.x;
  final qy = ownerRot.y;
  final qz = ownerRot.z;
  final qw = ownerRot.w;
  final sinp = (2 * (qw * qx - qy * qz)).clamp(-1.0, 1.0);
  final ownerPitch = math.asin(sinp);
  return (ownerPitch + pitch).clamp(-1.4, 1.4);
}