characterBody property

Implementation

static ComponentDefinition<CharacterBody3DComponent>
get characterBody => ComponentDefinition<CharacterBody3DComponent>(
  type: 'CharacterBody3DComponent',
  id: 'character_body_3d_f8ddd4a9',
  create: CharacterBody3DComponent.new,
  hints: ComponentHints(
    dimensions: Dimensions.threeD,
    name: 'Character Body 3D',
    group: _group,
    description:
        'A capsule gameplay moves: walks slopes, climbs steps, rides platforms. The entity\'s position is its feet.',
    icon: Icons.directions_walk,
    accentColor: const Color(0xFF29B6F6),
    fieldGroups: const {
      'Shape': ['radius', 'height', 'layer', 'detectable'],
      'Walking': ['maxSlopeAngle', 'stepHeight', 'stickToFloor'],
      'Forces': ['useGravity', 'gravityScale', 'mass', 'pushStrength'],
    },
    fields: {
      'radius': const FieldHint(label: 'Radius', scrub: _metres),
      'height': const FieldHint(label: 'Height', scrub: _metres),
      'layer': const FieldHint(
        label: 'Layer',
        description: PhysicsDefinitions.layerDescription,
      ),
      'detectable': const FieldHint(
        label: 'Detectable',
        description: PhysicsDefinitions.detectableDescription,
      ),
      'maxSlopeAngle': const FieldHint(
        label: 'Steepest slope',
        unit: AngleUnit.degrees,
        scrub: ScrubHint(step: 1, fractionDigits: 0, suffix: '°'),
      ),
      'stepHeight': const FieldHint(label: 'Step height', scrub: _metres),
      'stickToFloor': const FieldHint(
        label: 'Stick to floor',
        scrub: _metres,
      ),
      'useGravity': const FieldHint(label: 'Gravity and ground'),
      'gravityScale': FieldHint(
        label: 'Gravity scale',
        description: PhysicsDefinitions.gravityScaleDescription,
        scrub: const ScrubHint(step: 0.05, fractionDigits: 2, suffix: '×'),
        visibleWhen: (c) => (c as CharacterBody3DComponent).useGravity,
      ),
      'mass': const FieldHint(
        label: 'Mass',
        scrub: ScrubHint(step: 1, fractionDigits: 0, suffix: 'kg'),
      ),
      'pushStrength': const FieldHint(
        label: 'Push strength',
        scrub: ScrubHint(step: 5, fractionDigits: 0, suffix: 'N'),
      ),
    },
  ),
  fields: [
    _decimal<CharacterBody3DComponent>(
      'radius',
      (c) => c.radius,
      (c, v) => c.radius = v,
      min: 0.01,
    ),
    _decimal<CharacterBody3DComponent>(
      'height',
      (c) => c.height,
      (c, v) => c.height = v,
      min: 0.02,
    ),
    _decimal<CharacterBody3DComponent>(
      'maxSlopeAngle',
      (c) => c.maxSlopeAngle,
      (c, v) => c.maxSlopeAngle = v,
      min: 0,
    ),
    _decimal<CharacterBody3DComponent>(
      'stepHeight',
      (c) => c.stepHeight,
      (c, v) => c.stepHeight = v,
      min: 0,
    ),
    _decimal<CharacterBody3DComponent>(
      'stickToFloor',
      (c) => c.stickToFloor,
      (c, v) => c.stickToFloor = v,
      min: 0,
    ),
    _decimal<CharacterBody3DComponent>(
      'mass',
      (c) => c.mass,
      (c, v) => c.mass = v,
      min: 0,
    ),
    _decimal<CharacterBody3DComponent>(
      'pushStrength',
      (c) => c.pushStrength,
      (c, v) => c.pushStrength = v,
      min: 0,
    ),
    _decimal<CharacterBody3DComponent>(
      'gravityScale',
      (c) => c.gravityScale,
      (c, v) => c.gravityScale = v,
    ),
    _bool<CharacterBody3DComponent>(
      'useGravity',
      (c) => c.useGravity,
      (c, v) => c.useGravity = v,
    ),
    FieldDefinition(
      name: 'layer',
      kind: PhysicsDefinitions.layerType,
      read: (c) => (c as CharacterBody3DComponent).layer,
      write: (c, v) =>
          (c as CharacterBody3DComponent).layer = (v as num).toInt(),
    ),
    _bool<CharacterBody3DComponent>(
      'detectable',
      (c) => c.detectable,
      (c, v) => c.detectable = v,
    ),
  ],
);