AutoTetherComponent - acrimi/Raven GitHub Wiki

AutoTetherComponent works in conjunction with TetherComponent to automatically set its targetId based on configurable detection area. If any entities holding a TetherableComponent are detected in the given area, the first one will automatically linked to this entity's TetherComponent. The reach of the detection area is configurable, while the breadth of the area is always 1.

Configuration

When used inside the components block, the initial state of the component can be configured with the following parameters:

Key Type Description
latchDistance float|object An optional gap along the forward axis between the entities bounds and the detection area. Can be defined as a simple universal float value, or as an object containing separate values for the four main entity orientations. Defaults to 0, positioning the detection area at the forward edge of the entity.
      left float The latchDistance to use when the entity is facing left. If absent, the value of right wil be used. Defaults to 0 if right is also absent.
      right float The latchDistance to use when the entity is facing right. If absent, the value of left wil be used. Defaults to 0 if left is also absent.
      up float The latchDistance to use when the entity is facing up. Defaults to 0.
      down float The latchDistance to use when the entity is facing down. Defaults to 0.
latchDepth float|object The size, along the forward axis, of the detection area. Can be defined as a simple universal float value, or as an object containing separate values for the four main entity orientations.
      left float The latchDepth to use when the entity is facing left. If absent, the value of right wil be used. Defaults to 0 if right is also absent.
      right float The latchDepth to use when the entity is facing right. If absent, the value of left wil be used. Defaults to 0 if left is also absent.
      up float The latchDepth to use when the entity is facing up. Defaults to 0.
      down float The latchDepth to use when the entity is facing down. Defaults to 0.
latchMargin float|object An optional distance that the detection area must be, on the lateral axis, from the edge of the target entity in order to consider it a hit. Can be defined as a simple universal float value, or as an object containing separate values for the four main entity orientations.
      left float The latchMargin to use when the entity is facing left. If absent, the value of right wil be used. Defaults to 0 if right is also absent.
      right float The latchMargin to use when the entity is facing right. If absent, the value of left wil be used. Defaults to 0 if left is also absent.
      up float The latchMargin to use when the entity is facing up. Defaults to 0.
      down float The latchMargin to use when the entity is facing down. Defaults to 0.
latchOffset float|object An optional offset, on the lateral axis, to move the detection area from the center of the entity. Can be defined as a simple universal float value, or as an object containing separate values for the four main entity orientations. Defaults to 0, keeping the detection area centered laterally.
      left float The latchOffset to use when the entity is facing left. If absent, the value of right wil be used. Defaults to 0 if right is also absent.
      right float The latchOffset to use when the entity is facing right. If absent, the value of left wil be used. Defaults to 0 if left is also absent.
      up float The latchOffset to use when the entity is facing up. Defaults to 0.
      down float The latchOffset to use when the entity is facing down. Defaults to 0.

Examples:

"AutoTetherComponent": {
  "latchDistance": 2,
  "latchDepth": 22,
  "latchMargin": 2,
  "latchOffset": 1
}
"AutoTetherComponent": {
  "latchDistance": {
    "right": 2,
    "up": 2,
    "down": 0
  },
  "latchDepth": {
    "right": 22,
    "up": 14,
    "down": 16
  },
  "latchMargin": {
    "left": 1,
    "up": 2,
    "down": 1
  },
  "latchOffset": {
    "left": -1,
    "right": 1,
    "up": 1,
    "down": -1
  }
}

Properties

This component has no exposed properties