CarryComponent - acrimi/Raven GitHub Wiki
Extends ChildLinkedComponent
CarryComponent
holds a reference to another entity that is being carried by the current entity. The carried entity will be attached via TransformComponents and will have its position and orientation continually kept in sync with the holding entity. This can optionally be applied to the z axis as well, which will cause any forces along that axis, including gravity, to be continually negated while the entity is held.
When used inside the components
block, the initial state of the component can be configured with the following parameters:
Key | Type | Description |
---|---|---|
anchor | object | Defines how the carried entity should be attached relative to this entity's position |
x | float | The left position of the carried entity relative to the holding entity's left position. Defaults to 0 . |
y | float | The bottom position of the carried entity relative to the holding entity's bottom position. Defaults to 0 . |
zPosition | float | The position on the z axis the carried entity should be kept at. A ZComponent will be added to the carried entity if not already present if this value is specified. |
Example:
"CarryComponent": {
"anchor": {
"x": 2,
"y": 0
},
"zPosition": 16
}
The following properties are readable by property accessors (eg render state and persistence definitions):
Key | Type | Description |
---|---|---|
childId* | int | The id of the entity that is being carried, or -1 if no entity is currently being carried |
hasChild* | boolean | True if an entity is currently being carried, false otherwise |
* from ChildLinkedComponent