ThrustComponent - acrimi/Raven GitHub Wiki
ThrustComponent
applies a continuous force to an entity relative to its current orientation. The simplest configuration applies the same force as long as the component is attached, but different values can be set based on the scalar speed of the entity to facilitate non-terminal target speeds.
Configuration
When used inside the components
block, the initial state of the component can be configured with the following parameters:
Key | Type | Description |
---|---|---|
force | object|float | The default force that will be applied while the component is attached. A simple forward force can be supplied directly as a shorthand, or a 2-dimensional force can be defined as an object. |
forward | float | The forward force relative to the entity's orientation |
lateral | float | The lateral force relative to the entity's orientation |
speedThresholds | object | A map of alternate forces that will be applied once the entity's scalar speed reaches a certain value. The minimum value for each threshold is defined by each key, and the force is defined as the key's value. |
[speed] | object|float | The force that will be applied when the entity's scalar speed is greater than or equal to the float value specified by this key. A simple forward force can be supplied directly as a shorthand, or a 2-dimensional force can be defined as an object. |
forward | float | The forward force relative to the entity's orientation |
lateral | float | The lateral force relative to the entity's orientation |
Examples:
"ThrustComponent": {
"force": 1000
}
"ThrustComponent": {
"force": {
"forward": 700,
"lateral": 200
},
"speedThresholds": {
"30": {
"forward": 500,
"lateral": 100
},
"50.5": 0
}
}
Properties
The following properties are readable by property accessors (eg render state and persistence definitions):
Key | Type | Description |
---|---|---|
lastMagnitude | float | The scalar magnitude of the force that was last returned by this component, or 0 if the force has not been read yet. |