SurfaceComponent - acrimi/Raven GitHub Wiki

SurfaceComponent represents an entity's ability to act as a surface for other entities to be placed upon. As entities move into this entity's bounds, they will automatically be attached as children via TransformComponents, assuming the target already has a TransformComponent attached. This component will then serve as the source for friction and terrain properties for those entities instead of the underlying tile map. If a target does not have a TransformComponent, it will be ignored. The surface entity will have a TransformComponent attached automatically if necessary.

Configuration

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

Key Type Description
attachThreshold float How much an entity needs to overlap the surface entity before it is attached as a child, as a percentage of the child entity's total surface area, from 0 to 1. Defaults to 0.5.
terrain string An optional terrain that will be presented to entities that are attached to this surface.
frictionCoefficient float The friction coefficient that will be presented to entities that are attached to this surface. Defaults to 1.

Example:

"SurfaceComponent": {
  "attachThreshold": 0.2,
  "terrain": "ice",
  "frictionCoefficient": 0.7
}

Properties

This component has no exposed properties