hingeJoint property

ComponentSchema<HingeJoint3D> get hingeJoint

Implementation

static ComponentSchema<HingeJoint3D> get hingeJoint =>
    ComponentSchema<HingeJoint3D>(
      type: 'HingeJoint3D',
      id: 'hinge_joint_3d_d261402b',
      create: HingeJoint3D.new,
      hints: _jointHintsFor(
        'Hinge Joint 3D',
        'Lets two bodies turn about one axis: a door, a wheel.',
        Icons.door_front_door_outlined,
        groups: const {
          'Joint': ['connectedBody', 'anchor', 'axis', 'enabled'],
          'Limits': ['useLimits', 'minAngle', 'maxAngle', 'friction'],
          'Motor': ['motor', 'motorTarget', 'motorMaxTorque'],
        },
        fields: {
          'axis': const FieldHint(label: 'Axis'),
          'useLimits': const FieldHint(label: 'Limited'),
          'minAngle': FieldHint(
            label: 'Min angle',
            unit: AngleUnit.degrees,
            visibleWhen: (c) => (c as HingeJoint3D).useLimits,
          ),
          'maxAngle': FieldHint(
            label: 'Max angle',
            unit: AngleUnit.degrees,
            visibleWhen: (c) => (c as HingeJoint3D).useLimits,
          ),
          'friction': const FieldHint(label: 'Friction torque'),
          ..._motorHints('angle', 'Max torque').map(
            (k, v) => MapEntry(k == 'motorMax' ? 'motorMaxTorque' : k, v),
          ),
        },
      ),
      fields: [
        ..._jointFields<HingeJoint3D>(),
        _vector<HingeJoint3D>('axis', (c) => c.axis, (c, v) => c.axis = v),
        _bool<HingeJoint3D>(
          'useLimits',
          (c) => c.useLimits,
          (c, v) => c.useLimits = v,
        ),
        _decimal<HingeJoint3D>(
          'minAngle',
          (c) => c.minAngle,
          (c, v) => c.minAngle = v,
        ),
        _decimal<HingeJoint3D>(
          'maxAngle',
          (c) => c.maxAngle,
          (c, v) => c.maxAngle = v,
        ),
        _decimal<HingeJoint3D>(
          'friction',
          (c) => c.friction,
          (c, v) => c.friction = v,
          min: 0,
        ),
        SchemaField(
          name: 'motor',
          kind: _motor,
          read: (c) => (c as HingeJoint3D).motor,
          write: (c, v) => (c as HingeJoint3D).motor = v as MotorState3D,
        ),
        _decimal<HingeJoint3D>(
          'motorTarget',
          (c) => c.motorTarget,
          (c, v) => c.motorTarget = v,
        ),
        _decimal<HingeJoint3D>(
          'motorMaxTorque',
          (c) => c.motorMaxTorque,
          (c, v) => c.motorMaxTorque = v,
          min: 0,
        ),
      ],
    );