SwimComponent - acrimi/Raven GitHub Wiki
SwimComponent
represents a sinking state for an entity. It works in conjunction with TerrainAwareComponent by checking the percentage of the entity's surface area that overlaps with the "water"
terrain. If this percentage reaches a certain threshold, the component's active flag will be set. If the percentage falls back below the threshold, the flag will be unset.
Configuration
When used inside the components
block, the initial state of the component can be configured with the following parameters:
Key | Type | Description |
---|---|---|
terrainThreshold | float | The percentage, from 0 to 1 , of the entity's surface area that the "water" terrain must occupy before the component activates. Defaults to 0.9 . |
Example:
"SwimComponent": {
"terrainThreshold": 0.75
}
Properties
The following properties are readable by property accessors (eg render state and persistence definitions):
Key | Type | Description |
---|---|---|
isActive | boolean | Whether or not the entity's overlap with "water" has reached the defined threshold |