characterBody property

ComponentSchema<CharacterBody3D> get characterBody

Implementation

static ComponentSchema<CharacterBody3D>
get characterBody => ComponentSchema<CharacterBody3D>(
  type: 'CharacterBody3D',
  id: 'character_body_3d_f8ddd4a9',
  create: CharacterBody3D.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: PhysicsDefinitions2D.layerDescription,
      ),
      'detectable': const FieldHint(
        label: 'Detectable',
        description: PhysicsDefinitions2D.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: PhysicsDefinitions2D.gravityScaleDescription,
        scrub: const ScrubHint(step: 0.05, fractionDigits: 2, suffix: '×'),
        visibleWhen: (c) => (c as CharacterBody3D).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<CharacterBody3D>(
      'radius',
      (c) => c.radius,
      (c, v) => c.radius = v,
      min: 0.01,
    ),
    _decimal<CharacterBody3D>(
      'height',
      (c) => c.height,
      (c, v) => c.height = v,
      min: 0.02,
    ),
    _decimal<CharacterBody3D>(
      'maxSlopeAngle',
      (c) => c.maxSlopeAngle,
      (c, v) => c.maxSlopeAngle = v,
      min: 0,
    ),
    _decimal<CharacterBody3D>(
      'stepHeight',
      (c) => c.stepHeight,
      (c, v) => c.stepHeight = v,
      min: 0,
    ),
    _decimal<CharacterBody3D>(
      'stickToFloor',
      (c) => c.stickToFloor,
      (c, v) => c.stickToFloor = v,
      min: 0,
    ),
    _decimal<CharacterBody3D>(
      'mass',
      (c) => c.mass,
      (c, v) => c.mass = v,
      min: 0,
    ),
    _decimal<CharacterBody3D>(
      'pushStrength',
      (c) => c.pushStrength,
      (c, v) => c.pushStrength = v,
      min: 0,
    ),
    _decimal<CharacterBody3D>(
      'gravityScale',
      (c) => c.gravityScale,
      (c, v) => c.gravityScale = v,
    ),
    _bool<CharacterBody3D>(
      'useGravity',
      (c) => c.useGravity,
      (c, v) => c.useGravity = v,
    ),
    SchemaField(
      name: 'layer',
      kind: FieldTypes.physicsLayer,
      read: (c) => (c as CharacterBody3D).layer,
      write: (c, v) => (c as CharacterBody3D).layer = (v as num).toInt(),
    ),
    _bool<CharacterBody3D>(
      'detectable',
      (c) => c.detectable,
      (c, v) => c.detectable = v,
    ),
  ],
);