LiftComponent - acrimi/Raven GitHub Wiki
Extends StatefulComponent, ChildLinkedComponent
LiftComponent
defines an entity's ability to lift another entity that has a LiftableComponent. When a target entity is set and the component is activated, it will move the liftable entity along the path configured in this component according to the lifting entity's orientation. The liftable entity will attached as a child of the lifter via TransformComponents once lifting begins. Upon completion, the liftable will be disassociated from the component and set as the target for the lifter's CarryComponent, if present.
The component doesn't support custom enter/exit states or a non-default initial state. It also doesn't support a custom duration for the "active"
state. Instead the maximum total duration for any one of the path orientations will be used automatically as the "active"
state duration.
When used inside the components
block, the initial state of the component can be configured with the following parameters:
Key | Type | Description |
---|---|---|
mirrored | boolean | Whether or not the left/right paths should be mirrored around the entity's horizontal axis when the opposite direction is missing. This can help avoid creating redundant configurations for each direction. |
path | object | An object containing the path configurations the liftable entity should follow for each orientation. Each key should correspond to the lowercased name of an EntityOrientation (eg "right" , "up" , etc). |
[orientation] | object[] | An array containing the path sequence the liftable entity should follow for the orientation named by this key. Each object contains a start and end point for that portion of the path and the time that step takes to complete. Stationary steps can be defined by only specifying a duration and omitting the start and end positions. |
duration | float | The duration, in seconds, that this portion of the path takes to complete. Defaults to 0 . |
start | object | An object containing the starting coordinates of the liftable entity for this portion of the path. If omitted, the liftable entity will start from its current position for this step of the path. |
x | float | The left position of the liftable entity |
y | float | The bottom position of the liftable entity |
z | float | The z axis position of the liftable entity |
end | object | An object containing the end coordinates of the liftable entity for this portion of the path. If omitted, the liftable entity will not move from its starting position for this step of the path. |
x | float | The left position of the liftable entity |
y | float | The bottom position of the liftable entity |
z | float | The z axis position of the liftable entity |
Example:
"LiftComponent": {
"mirrored": true,
"path": {
"up": [
{
"duration": 0.21
},
{
"start": {
"x": -2,
"y": 10,
"z": 0
},
"end": {
"x": -2,
"y": 8,
"z": 28
},
"duration": 0.1
}
],
"down": [
{
"duration": 0.21
},
{
"start": {
"x": -2,
"y": -16,
"z": 0
},
"end": {
"x": -2,
"y": -14,
"z": 27
},
"duration": 0.1
}
],
"right": [
{
"duration": 0.21
},
{
"start": {
"x": 13,
"y": 0,
"z": 0
},
"end": {
"x": 11,
"y": 0,
"z": 27
},
"duration": 0.1
}
]
}
}
The following properties are readable by property accessors (eg render state and persistence definitions):
Key | Type | Description |
---|---|---|
isActive* | boolean | Whether or not the current state is "active"
|
isInactive* | boolean | Whether or not the current state is "inactive"
|
state* | string | The name of the current state |
progress* | float | The percentage, from 0 to 1 , of how much time has elapsed for the current state relative to its duration (elapsedTime / duration). If the current state has an infinite duration, this value is always 0 . |
childId** | int | The id of the child entity referenced by this component, or -1 if no entity is currently linked |
hasChild** | boolean | True if an entity is currently referenced by this component, false otherwise |
* from StatefulComponent
** from ChildLinkedComponent